wip: add more questions

chore/javascript
Arik Chakma 1 year ago
parent 0331e1f782
commit 66eff7af70
  1. 19
      src/data/question-groups/javascript/content/spread-operator.md
  2. 10
      src/data/question-groups/javascript/javascript.md

@ -0,0 +1,19 @@
The spread operator in JavaScript is represented by three dots (`...`). It allows the elements of an array or properties of an object to be expanded or "spread" into individual elements or properties. This can be useful in various contexts, such as when passing elements as function arguments, cloning arrays and objects, or merging arrays and objects.
```js
const roadmaps = ['JavaScript', 'React', 'Node.js'];
const bestPractices = ['AWS', 'API Security'];
const resources = [...roadmaps, ...bestPractices];
console.log(resources); // ['JavaScript', 'React', 'Node.js', 'AWS', 'API Security']
```
```js
const roadmap = {
name: 'JavaScript',
type: 'dynamic',
};
const roadmapClone = { ...roadmap }; // shallow copy
console.log(roadmapClone); // { name: 'JavaScript', type: 'dynamic' }
```

@ -158,4 +158,14 @@ questions:
topics: topics:
- 'Core' - 'Core'
- 'Beginner' - 'Beginner'
- question: What is Event Capturing in JavaScript?
answer: Event capturing is the first phase of event propagation. In this phase, the event is captured by the outermost element and propagated to the inner elements. It is also known as trickling. It is the opposite of event bubbling.
topics:
- 'Core'
- 'Beginner'
- question: What is the spread operator in JavaScript?
answer: spread-operator.md
topics:
- 'Core'
- 'Intermediate'
--- ---

Loading…
Cancel
Save