-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpractice.js
106 lines (70 loc) · 1.79 KB
/
practice.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
// console.log("Hi there");
//it just prints out hi there
/*this is a
multiline comment*/
//this is a
//multiple comment
// var a;
// a = 10;
// var b = "John";
//8 basic data types in javascript
// const message = "hello";
// message = 12345;
// console.log(message);
//1 Number
// let n = 123;
// n = 12.345;
// console.log(n);
//specific numeric numbers
//Infinity
// alert(1 / 0);
// console.log(1 / 0);
// console.log(Infinity);
//NaN
// console.log(NaN + 1);
// console.log(NaN * 3);
// console.log("not a number" / 2 - 1);
// console.log(NaN * 0);
// console.log(NaN ** 0); //exception
// //2 BigInt
// const bigInt = 9007199254740991n;
// console.log(bigInt);
//3 String
//simple quotes
// let str = "Hello";
// let str2 = "Single Quotes";
// //extended functionality embeds a value ${}
// let str3 = `${str} , how are you doing`;
// console.log(str3);
// console.log(`the result is ${1 + 2}`);
// console.log("the substraction is ${2 - 1}");
//4 Boolean (logical type)
// let isChecked = false;
// let isGreater = 4 > 1;
// console.log(isGreater);
//5 Null
// let age = null;
// console.log(age);
//its just a special value which represents nothing, empty or a value unknown
//6 undefined
//it means value is not defined
//7 Object and Symbols nom-primitive
//used for more complex data structures
//Type Coversions
// alert(8);
//String Conversion
// let value = true;
// value = String(value);
// console.log(typeof value);
//Numeric Conversion
// alert("6" / "2");
// let str = "123";
// let num = Number(str);
// console.log(typeof num);
// let age = Number("A string instead of a number");
// console.log(age);
// console.log(Number(" 123 "));
// console.log(Number(true));
// console.log(Number("123a"));
// console.log(Number(undefined));
// console.log(Number(null));