Add simple_types.ts
This commit is contained in:
14
src/simple_types.ts
Normal file
14
src/simple_types.ts
Normal file
@@ -0,0 +1,14 @@
|
||||
// You technically don't need to declare the variable type
|
||||
let isBoolean: boolean = true;
|
||||
let isBooleanInferred = true;
|
||||
|
||||
// TypeScript uses 'number' for all numeric values
|
||||
let decimal: number = 6;
|
||||
let hex: number = 0xf00d;
|
||||
let binary: number = 0b1010;
|
||||
let octal: number = 0o744;
|
||||
let float: number = 3.14;
|
||||
|
||||
// String works with single, double, or backticks
|
||||
let color: string = "purple";
|
||||
let favorite_color = "blue";
|
||||
Reference in New Issue
Block a user