-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path2nd.js
More file actions
151 lines (124 loc) · 4.93 KB
/
2nd.js
File metadata and controls
151 lines (124 loc) · 4.93 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
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
//Data type in JS
/* There are two type of data types
1.premetive(imutable))
2.non premetive(mutable)*/
// only "object" is the data type
let a=2;
let b=3;
console.log(typeof a); //javas Know itself the type of variable we can find it by (typeof)
console.log (2+3);
console.log(a+b);
//number is premetive
//symbol is premetive
console.log("***************************************************************************************")
console.log(2+3-4*6/7); //if follow the BODMAS rule
console.log("***************************************************************************************")
console.log(2+3-4*6/7%2); // if same the modulus same as python
console.log("***************************************************************************************")
let str="abcd"; //everything in between "" is sttring
let string=""; //empty string
console.log("***************************************************************************************")
console.log(str[0]); //finding index
console.log(str[4]); //if not a present undified
console.log(typeof str); //datatype finding
//string is imutable
//trivercing is possible in strings
//floor
//non-decimal value is floor
//example:4.999=4
//in case of negative it is totally opposite
//cell
//non-decimal value is floor
//example:4.999=5
//in case of negative it is totally opposite
//going to the bigger value
//round value
//logic of normal maths rounding off the value
//example:4.4=4, 4.6=5
//in case of negative it is totally opposite
//going to bigger ND Smaller value according to condition
console.log(Math.max(1,2,3,4,5,6,7,8,9)) //time complexity of same
console.log(Math.min(1,2,3,4,5,6,7,8,9)) //just to easy code
console.log("***************************************************************************************")
console.log("abcd".includes("c")); //checking true or false while present or not
console.log("abcd".indexOf("c")); //indexOF sortcut to find directly
console.log("***************************************************************************************")
console.log("abc"+"def")
console.log("***************************************************************************************")
let w="abc";
console.log(w+"def")
console.log("***************************************************************************************")
let name="Arun";
let rolno=99;
console.log("My name is "+ name + ".\nmy rollno is"+rolno + "."); //proper way to add using +
console.log(`My name is ${name}. My rollno is ${rolno}.`); // use ${} to reduse time it is basically used as f string in python
console.log("***************************************************************************************")
let k=true;
let l=false;
console.log(typeof k); //to express boolean Type
console.log("***************************************************************************************")
let g;
console.log(typeof g); //type exists as undified
console.log("***************************************************************************************")
let j=null;
console.log(typeof j); // sep
console.log("***************************************************************************************")
/* premetive datatype
number
bigint
boolean
undefined
symbol
null*/
console.log("***************************************************************************************")
//if and else
//AND &&
//OR ||
if (a%2==0){
console.log("True")
}
else
{
console.log("False")
}
console.log("***************************************************************************************")
z="ram"
y="singh"
console.log(z+" "+y)
/*output
number
5
5
***************************************************************************************
1.5714285714285716
***************************************************************************************
3.5714285714285716
***************************************************************************************
***************************************************************************************
a
undefined
string
9
1
***************************************************************************************
true
2
***************************************************************************************
abcdef
***************************************************************************************
abcdef
***************************************************************************************
My name is Arun.
my rollno is99.
My name is Arun. My rollno is 99.
***************************************************************************************
boolean
***************************************************************************************
undefined
***************************************************************************************
object
***************************************************************************************
***************************************************************************************
True
***************************************************************************************
ram singh*/