Skip to main content
1 of 2
vrluckyin
  • 261
  • 1
  • 5

#2012 - TypeScript#

TypeScript is a free and open source programming language developed and maintained by Microsoft.

Main goal is: Any browser. Any host. Any OS. Open Source. It was released on October, 2012

Hello TypeScript

Task1(name:string,year:number) {
    return name + " was made in "+ year +"!";
}

ASCII Art

Task2(n:number,separator:string,space:string) {
    var result:string = "";
    for (var k = 0; k < n; k++)
    {
        for (var j = 0; j < n; j++)
        {
            var i = ((n * k) + j) % n;
            result+=(i == 0 || i == n - 1 || i == k) ? "N" : space;
        }
        result+=separator;
    }
    return result;
}

GCD

Task3(a:number,b:number) {
    while (a != 0 && b != 0)
        {
            if (a > b)
                a %= b;
            else
                b %= a;
        }

        if (a == 0)
            return b;
        else
            return a;
}

try it online, and screencast of it.

vrluckyin
  • 261
  • 1
  • 5