number
const n: number = 3.14159
console.log(n.toFixed(3));
console.log(Number.POSITIVE_INFINITY);
console.log(Number.NEGATIVE_INFINITY);
string
const s: string = 'ABC';
console.log(s.charCodeAt(0));
const n: number = 0x41;
console.log(String.fromCharCode(n));
array
const arr: Array<Array<number>> = Array.from(Array(5), () => Array(3).fill(0));
const n: number[] = [1, 2, 3, 4];
console.log(n.reduce((s, c) => s+c, 0));
const n: number[] = [1, 2, 3, 4];
console.log(n.map(v => v+2));
const s: string[] = ['a', 'b', 'c'];
console.log(s.join());
console.log(s.join(''));
const n: number[] = [1, 100, 10];
console.log(n.sort());
const compare = (a: number, b: number) => b-a;
console.log(n.sort(compare));
const arr1: Array<number> = [1, 2, 3];
const arr2: Array<number> = [4, 5, 6];
arr1.push(...arr2)
console.log(arr1);
Math
const n = 1.4;
console.log(Math.ceil(n));
console.log(Math.floor(n));
console.log(Math.round(n));
기타
const n: number = 123;
for(let c of String(n)) console.log(c, typeof(c));
const n: number[] = [1, 2, 3, 4];
const [a, ...b] = n;
console.log(a, b);
console.log([...b, a]);
참고