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 0147fd9

Browse files
Added Question-Answer 63 to 67
1 parent 55632b4 commit 0147fd9

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

‎README.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,11 @@
6767
| 60 | [Name some JavaScript frameworks and libraries](#60-name-some-javascript-frameworks-and-libraries) |
6868
| 61 | [What is event bubbling and event capturing](#61-what-is-event-bubbling-and-event-capturing) |
6969
| 62 | [What is the role of event.stopPropagation()](#62-what-is-the-role-of-eventstoppropagation) |
70+
| 63 | [How can we change the style of an element using javascript](#63-how-can-we-change-the-style-of-an-element-using-javascript) |
71+
| 64 | [What is object destructuring](#64-what-is-object-destructuring) |
72+
| 65 | [Difference between an Alert Box and a Confirmation Box](#65-difference-between-an-alert-box-and-a-confirmation-box) |
73+
| 66 | [How can we handle exceptions with javascript](#66-how-can-we-handle-exceptions-with-javascript) |
74+
| 67 | [What are the advantages of using External JavaScript](#67-what-are-the-advantages-of-using-external-javascript) |
7075

7176
### 1. What is JavaScript
7277
* JavaScript is a scripting language used to create dynamic and interactive websites. It is supported by all major web browsers.
@@ -969,6 +974,54 @@ This method is used to stop the event from propagating up or down the DOM hierar
969974
970975
**[:top: Scroll to Top](#javascript-interview-questions)**
971976
977+
### 63. How can we change the style of an element using javascript
978+
To change the style of an element using JavaScript, we can use the style property of the element's DOM object.
979+
```js
980+
document.getElementById("myDiv").style.backgroundColor = "red";
981+
```
982+
**[:top: Scroll to Top](#javascript-interview-questions)**
983+
984+
### 64. What is object destructuring
985+
Object destructuring allows you to extract properties from an object and assign them to variables.
986+
```js
987+
const fullname = {
988+
firstName: 'Surbhi',
989+
lastName: 'Dighe',
990+
};
991+
const { firstName, lastName } = fullname;
992+
console.log(firstName); // output ========> 'Surbhi'
993+
console.log(lastName); // output ========> 'Dighe'
994+
```
995+
**[:top: Scroll to Top](#javascript-interview-questions)**
996+
997+
### 65. Difference between an Alert Box and a Confirmation Box
998+
**Alert Box** - It has only one button, typically labeled "OK" and it is used to display a message to the user.
999+
1000+
**Confirmation Box** - It has two buttons, typically labeled "OK" and "Cancel" and it is used to ask the user to confirm an action.
1001+
1002+
**[:top: Scroll to Top](#javascript-interview-questions)**
1003+
1004+
### 66. How can we handle exceptions with javascript
1005+
In JavaScript, we can handle exceptions using a try-catch block. The try block contains the code that might throw an exception, and the catch block contains the code that handles the exception if it occurs.
1006+
```js
1007+
try {
1008+
const name = "Surbhi";
1009+
console.log(firstname)
1010+
} catch (error) {
1011+
console.log("Error: " + error); // output ========> Error: ReferenceError: firstname is not defined
1012+
}
1013+
```
1014+
**[:top: Scroll to Top](#javascript-interview-questions)**
1015+
1016+
### 67. What are the advantages of using External JavaScript
1017+
- Improve the load time of web pages
1018+
- Ease of editing
1019+
- Code reusability
1020+
- Separation of Code
1021+
1022+
**[:top: Scroll to Top](#javascript-interview-questions)**
1023+
1024+
9721025
## Output Based Questions
9731026
9741027
**1. What will be the output**

0 commit comments

Comments
(0)

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