You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
letgreetings: 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
+
letnumber: number=6;
15
+
// number = "" // Type 'string' is not assignable to type 'number'.
0 commit comments