You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/interview-questions.md
+61-1Lines changed: 61 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Theoretical Questions
2
2
3
-
`Q001:` What is typeof Operator?
3
+
`Q001:` What is `typeof` Operator?
4
4
5
5
Answer: JavaScript provides a `typeof` operator that can examine a value tell you what type is is:
6
6
@@ -51,3 +51,63 @@ obj['b'];
51
51
obj['c'];
52
52
53
53
```
54
+
55
+
`Q003:` Explain `arrays` in JavaScript.
56
+
57
+
Answer: An `array` is an object that holds values (of any type) not particularly in named properties/keys, but rather in numerically indexed positions:
58
+
59
+
```
60
+
61
+
const arr = [
62
+
'hello world',
63
+
42,
64
+
true
65
+
];
66
+
67
+
arr[0]; // 'hello world';
68
+
arr[1]; // 42
69
+
arr[3]; // true
70
+
arr.length? // 3
71
+
72
+
73
+
typeof arr; // "object";
74
+
75
+
```
76
+
77
+
`Q004:` What is `scope` in JavaScript?
78
+
79
+
Answer: In JavaScript, each function gets its own scope. Scope is basically a collection of variables as well as the rules for how those variables are accessed by name. Only code inside that function can access that function's scoped variables.
80
+
81
+
1. A variable name has to be unique within the same scope.
82
+
2. A scope can be nested inside another scope.
83
+
3. If one scope is nested inside another, code inside the innermost scope can access variables from either scope.
84
+
85
+
86
+
`Q005:` Explain `equality` in JavaScript.
87
+
88
+
Answer: JavaScript has both strict and type converting comparisons:
89
+
90
+
1. Strict comparison (`===`) checks for value quality without allowing coercion.
0 commit comments