출처 : 생활코딩
실습 : TS Playground
Array 예제)
// TS
// Array
let arr1:number[] = [1,2,3];
console.log(arr1);
let arr2:Array<number> = [1,2,3];
console.log(arr2);
let arr3: string[] = ["hello", "Seong"];
console.log(arr3);
let arr4:Array<string> = ["Seong", "Ho", "Kim"];
console.log(arr4);
Type 별 Array 사용 방법)
// number Type
let arr1:number[] = [1,2,3];
let arr2:Array<number> = [1,2,3];
// string type
let arr3: string[] = ["hello", "Seong"];
let arr4:Array<string> = ["Seong", "Ho", "Kim"];
Javascript Array 변환)
// JS
// Array
let arr1 = [1, 2, 3];
console.log(arr1); // [1,2,3]
let arr2 = [1, 2, 3];
console.log(arr2); // [1,2,3]
let arr3 = ["hello", "Seong"];
console.log(arr3);
let arr4 = ["Seong", "Ho", "Kim"];
console.log(arr4);
tuple 예제)
let tuple : [string, number, boolean] = ["hello", 30, true];
console.log(tuple);
Javascript 변환)
let tuple = ["hello", 30, true];
console.log(tuple);