Skip to content

Commit c451e7d

Browse files
author
wakidurrahman
committed
feat: explain arrays in javascript
1 parent 0f320f3 commit c451e7d

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/interview-questions.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,25 @@ obj['c'];
5252
5353
```
5454

55+
56+
`Q003:` Explain `arrays` in JavaScript.
57+
58+
Answer: An `array` is an object that holds values (of any type) not particularly in named properties/keys, but rather in numerically indexed positions:
59+
60+
```
61+
62+
const arr = [
63+
'hello world',
64+
42,
65+
true
66+
];
67+
68+
arr[0]; // 'hello world';
69+
arr[1]; // 42
70+
arr[3]; // true
71+
arr.length? // 3
72+
73+
74+
typeof arr; // "object";
75+
76+
```

0 commit comments

Comments
 (0)