Skip to content

Commit 87abb37

Browse files
committed
day 4 javascripts interview
1 parent bb08227 commit 87abb37

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

JavaScript Interview/Day 4/demo.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
/*
2+
3+
Array(2):
4+
5+
When you pass a single numeric argument to the Array constructor, it creates an array
6+
with that length but does not initialize the elements. The array will have "empty slots."
7+
Example: Array(2) creates an array with a length of 2,
8+
but it has no values, resulting in [ , ]. These "empty slots" are different from undefined.
9+
10+
11+
1.
12+
console.log(Array(1, 2)); // [1, 2]
13+
console.log(Array(2)); // [ , ]
14+
15+
16+
2.
17+
console.log(typeof(NaN))
18+
console.log(NaN)
19+
console.log(NaN==4)
20+
console.log(NaN=="4")
21+
console.log(NaN!=4)
22+
console.log(NaN==true)
23+
console.log(NaN==false)
24+
25+
output
26+
27+
number
28+
NaN
29+
false
30+
false
31+
true
32+
false
33+
false
34+
35+
36+
In JavaScript, NaN stands for "Not-a-Number,"
37+
and it is a special value used to represent invalid or undefined numerical
38+
results. The key point here is that NaN is a falsy value
39+
40+
41+
3. if (NaN) {
42+
console.log("i am there")
43+
} else {
44+
console.log("i am not there")
45+
}
46+
47+
output
48+
i am not there
49+
*/
50+
51+

0 commit comments

Comments
 (0)