// let age:number = 50
// let height:number = 175.5
// let isStudent:boolean = true
// let isOpen:boolean = false
// let name: string = "Alice"
// let greeting: string = 'Hello, TypeScript!';
// let score:number|null = null
// let description:string|undefined = undefined
// const symbol1 = Symbol("key1")
// const symbol2 = Symbol("key2")
// let value:any = 2
// value = "111"
// value = true
// function test(message: string): void {
// }
// function throwError(message: string): never {
// throw Error(message)
// }
// let person = {
// name : "John",
// age : 30,
// greet() {
// console.log("Hello, I'm" this.name);
// }
// }
let a: number[] = [1, 2, 3];
let b: Array<number> = [2, 3, 5];
let c: [number, string] = [5, "11"];
enum Color {
Red = 2,
Green,
Blue
}
let color: Color = Color.Red;
console.log(color)
let aunknown: unknown = 5;
function aa(): void {
console.info("aa")
}
aa()
let undefinedvar: undefined = undefined;
let nullvar: null = null;
let unionvar: number | string = 5;
console.log("aunknown===unionvar:" + (aunknown === unionvar));
function test2(num: number, num2?: number) {
if (num2) {
console.log("num2:" + num2);
} else {
console.log("num:" + num);
}
}
test2(1, 2);
test2(5);
function test3(...arr: number[]) {
for (let num of arr) {
console.log(num)
}
}
test3(1, 55, 6);
test3(25);