-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdatatypes.js
More file actions
77 lines (65 loc) · 1.45 KB
/
datatypes.js
File metadata and controls
77 lines (65 loc) · 1.45 KB
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
"use strict";// treat all code as new version of js
//alert (3+3)// on browser not here
//string
let name="Beluga"
//number
let age=12
//undefined
let address;
//object
let salary=null
//bool
let married=false
//printing
console.log(name,age,address,salary,married)
//finding the type
console.log(typeof(salary))
console.log(typeof(married))
// more over
// number => 2 to power 53
// bigint
// string => ""
// boolean => true/false
// null => standalone value
// undefined =>
// symbol => unique
//conversion of no into string success
let weight=68
let weightinstring= String (weight)
console.log(typeof(weightinstring))
console.log(weightinstring)
//conversion of string into n0 notsucess
let lastname="suchita"
let lastnameconversion=Number(lastname)
console.log(typeof(lastnameconversion))
console.log(lastnameconversion)
//bool to no success
let marriedtono=Number(married)
console.log(typeof(marriedtono))
console.log(marriedtono)
// not suceess
let password="33abf"
let passwordintonotry=Number(password)
console.log(typeof(passwordintonotry))
console.log(passwordintonotry)
//operation
//1
let score=33
let scoreneg=-score
console.log(scoreneg)
//2
console.log(3+4)
console.log(2**2)//power
//3 concatinate
let str1='hi'
let str2='shutup'
let str3=str1+str2
console.log(str3)
//4
console.log("1" + 2);
console.log(1 + "2");
console.log("1" + 2 + 2);
console.log(1 + 2 + "2");
//5 tricky way to print 1 and 0
console.log(+true);
console.log(+"");