Skip to content

Commit f4c84e6

Browse files
committed
ts Intro
1 parent 4be1e90 commit f4c84e6

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

TS/Basics/Basics.ts

Lines changed: 0 additions & 2 deletions
This file was deleted.

TS/Basics/intro.ts

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
let greetings: string = "Hello! Welcome to TypeScript";
2+
// greetings = 6; // Type 'number' is not assignable to type 'string'.
3+
console.log(greetings.toUpperCase());
4+
console.log(greetings);
5+
6+
// The primitives: string, number, and boolean
7+
// JavaScript has three very commonly used primitives: string, number, and boolean. Each has a corresponding type in TypeScript.
8+
9+
// 1. string represents string values like "Hello, world"
10+
// 2. number is for numbers like 42. JavaScript does not have a special runtime value for integers, so there’s no equivalent to int or float - everything is simply number
11+
// 3. boolean is for the two values true and false
12+
13+
// Number
14+
let number: number = 6;
15+
// number = "" // Type 'string' is not assignable to type 'number'.
16+
console.log(number);
17+
18+
let userID: number = 334455;
19+
console.log(userID);
20+
21+
// Boolean
22+
let isLoggedIn: boolean = false
23+
24+
export {}

0 commit comments

Comments
 (0)