1+
2+ console . log ( [ 1 , 2 , 3 ] + [ 4 , 5 , 6 ] ) ; // [1,2,34,5,6] - concatenation of two arrays
3+
4+ console . log ( "1,2,3" + "4,5,6" )
5+
6+ console . log ( [ 1 , 2 , 3 ] - [ 4 , 5 , 6 ] ) // NaN
7+
8+ console . log ( 1 + "1" - 1 ) // 10
9+
10+ let x = 1 ;
11+ let y = "1"
12+ console . log ( x == y ) // true
13+ console . log ( x === y ) // false
14+
15+
16+ console . log ( typeof NaN === "number" ) // type``of NaN is number is string ==="strtring" // true
17+ console . log ( typeof [ ] ) // object
18+
19+ /*what is spread operator
20+ Spread operator is used to expand an iterable (like an array) into its individual elements.
21+ It is denoted by three dots (...).
22+ */
23+ function foo ( ) {
24+ return ;
25+ {
26+ bar : "hello" ;
27+
28+ }
29+ }
30+ console . log ( foo ( ) ) // undefined
31+
32+ /*
33+ Which of this looping structure is not supported in JavaScript?
34+ 1. for..in
35+ 2. for..of
36+ 3. for..each
37+ 4. for..loop
38+ Answer: 3. for..each
39+ */
40+
41+ /* const can not be updated or re-declared within the same scope.
42+ const a=20;
43+ a=30; // TypeError: Assignment to constant variable.
44+
45+
46+
47+
48+ 14. What is a promise in JavaScript?
49+ A) A function that always returns true
50+ B) A value that may be available now, later, or never
51+ C) A global object for HTTP requests
52+ D) A variable that can't be changed
53+
54+ Answer: B) A value that may be available now, later, or never
55+ */
56+
57+ console . log ( typeof null ) // object
58+
59+ let a = { }
60+ let b = a
61+ a . name = "JS"
62+ console . log ( b . name ) // JS
63+
64+ /*
65+ let is a block-scoped variable declaration keyword in JavaScript.
66+ let can be updated
67+ but not re-declared within the same scope.
68+ */
69+ let arr = [ 1 , 2 , 3 ] ;
70+ arr . length = 0 ;
71+ console . log ( arr ) // [] - empty array
72+
73+
74+ const c = [ 1 , 2 ] ;
75+ const d = [ 1 , 2 ] ;
76+ console . log ( JSON . stringify ( c ) === JSON . stringify ( d ) ) ; // true
77+ // JSON.stringify() converts a JavaScript object or value to a JSON string.
0 commit comments