Skip to content

Commit 99384b6

Browse files
Merge pull request #94 from wakidurrahman/docs/javascript-001
docs: question and answer
2 parents 7e97074 + 946d705 commit 99384b6

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

docs/interview-questions.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Theoretical Questions
2+
3+
`Q001:` What is typeof Operator?
4+
5+
Answer: JavaScript provides a `typeof` operator that can examine a value tell you what type is is:
6+
7+
```
8+
9+
let a;
10+
typeof a; // 'undefined'
11+
12+
a = "hello world";
13+
typeof a; // "string";
14+
15+
16+
a = 44;
17+
typeof a; // "number"
18+
19+
a = null;
20+
typeof a; // 'object'
21+
22+
a = true;
23+
typeof a; // "boolean";
24+
25+
a = undefined;
26+
typeof a; // "undefined";
27+
28+
a = { b: 'c'};
29+
typeof a; // "object"
30+
31+
32+
```
33+
34+
`Q002:` What is the `object` type?
35+
36+
Answer: The `object` type refers to a compound value where you can set properties(named locations) that each hold their own values of any type.
37+
38+
```
39+
const obj = {
40+
a: 'Hello World" ,
41+
b: 42,
42+
c: true
43+
};
44+
45+
obj.a;
46+
obj.b;
47+
obj.c;
48+
49+
obj['a'];
50+
obj['b'];
51+
obj['c'];
52+
53+
```

0 commit comments

Comments
 (0)