📜  typescript vs javascript - 任何代码示例

📅  最后修改于: 2022-03-11 14:56:34.148000             🧑  作者: Mango

代码示例3
// What differs typescript from javascript is the strict usage of types.
// Javascript is a loosely typed language, 
// while Typescript is strictly typed.

// Javascript
let car = 'BMW';
let age = 15;

// Typescript
let car: string = 'BMW';
let age: number = 15;