Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 1401a40

Browse files
Question-Answer-52-53
1 parent f0b6afe commit 1401a40

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

‎README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,8 @@ Top JavaScript interview questions
5757
| 49 | [ES6 and its features](#49-es6-and-its-features) |
5858
| 50 | [Difference between function and method](#50-difference-between-function-and-method) |
5959
| 51 | [What is aync and await](#51-what-is-aync-and-await) |
60+
| 52 | [What is the role of event.preventDefault()](#52-what-is-the-role-of-eventpreventdefault) |
61+
| 53 | [What is the use of JSON.stringify()](#53-what-is-the-use-of-jsonstringify) |
6062

6163

6264
### 1. What is JavaScript
@@ -788,4 +790,15 @@ const getData = async () => {
788790
getData();
789791
```
790792
793+
### 52. What is the role of event.preventDefault()
794+
The preventDefault() method is used to stop the default action of an element.
791795
796+
E.g., when a user submits a form, the browser sends the form data to the URL specified in the action attribute. In some cases, we may want to prevent this default behavior.
797+
798+
### 53. What is the use of JSON.stringify()
799+
JSON.stringify() method is used to convert a JavaScript object or value into an equivalent JSON string.
800+
```js
801+
const obj = { firstname: "Surbhi", lastname: "Dighe" };
802+
const jsonString = JSON.stringify(obj);
803+
console.log(jsonString); // output ========> {"firstname":"Surbhi","lastname":"Dighe"}
804+
```

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /