wip: add more questions

chore/javascript
Arik Chakma 1 year ago
parent 66eff7af70
commit 4d0143f137
  1. 10
      src/data/question-groups/javascript/content/prevent-default.md
  2. 10
      src/data/question-groups/javascript/javascript.md

@ -0,0 +1,10 @@
The `event.preventDefault()` method is used to prevent the default action of an event. For example, when you click on a link, the default action is to navigate to the link's URL. But, if you want to prevent the navigation, you can use `event.preventDefault()` method.
```js
const link = document.querySelector('a');
link.addEventListener('click', (event) => {
event.preventDefault();
console.log('Clicked on link!');
});
```

@ -168,4 +168,14 @@ questions:
topics:
- 'Core'
- 'Intermediate'
- question: Is Java and JavaScript the same?
answer: No, Java and JavaScript are distinct languages. Their similarity in name is coincidental, much like `car` and `carpet`. Java is often used for backend and mobile apps, while JavaScript powers web interactivity and backend.
topics:
- 'Core'
- 'Beginner'
- question: What is `preventDefault()` method in JavaScript?
answer: prevent-default.md
topics:
- 'Core'
- 'Intermediate'
---

Loading…
Cancel
Save