|
85 | 85 | | 78 | [What is a service worker](#78-what-is-a-service-worker) |
|
86 | 86 | | 79 | [What is JSON](#79-what-is-json) |
|
87 | 87 | | 80 | [How can you get all the keys of any object](#80-how-can-you-get-all-the-keys-of-any-object) |
|
| 88 | +| 81 | [What is a unary function](#81-what-is-a-unary-function) | |
| 89 | +| 82 | [What is promise chaining](#82-what-is-promise-chaining) | |
| 90 | +| 83 | [What is eval](#83-what-is-eval) | |
88 | 91 |
|
89 | 92 | ### 1. What is JavaScript
|
90 | 93 | * JavaScript is a scripting language used to create dynamic and interactive websites. It is supported by all major web browsers.
|
@@ -1191,6 +1194,32 @@ console.log(keys); // output ========> ["name", "city"]
|
1191 | 1194 |
|
1192 | 1195 | **[:top: Scroll to Top](#javascript-interview-questions)**
|
1193 | 1196 |
|
| 1197 | +### 81. What is a unary function |
| 1198 | +A unary function is a function that takes only one argument |
| 1199 | +```js |
| 1200 | +function greet(message){ |
| 1201 | +console.log(message, "unary function example"); |
| 1202 | +} |
| 1203 | +``` |
| 1204 | + |
| 1205 | +**[:top: Scroll to Top](#javascript-interview-questions)** |
| 1206 | + |
| 1207 | +### 82. What is promise chaining |
| 1208 | +Promise chaining is the term used to describe the process of executing a series of asynchronous tasks one after another in a specific order |
| 1209 | +```js |
| 1210 | +fetch('API_URL') |
| 1211 | + .then(response => response.json()) |
| 1212 | + .then(data => printData(data)) |
| 1213 | + .then(anotherData => printAnotherData(anotherData)) |
| 1214 | + .then(finalData => printFinalData(finalData)) |
| 1215 | +``` |
| 1216 | +**[:top: Scroll to Top](#javascript-interview-questions)** |
| 1217 | + |
| 1218 | +### 83. What is eval |
| 1219 | +The eval() is a method of the JavaScript global object and it takes a string as an argument and evaluates it. |
| 1220 | +```js |
| 1221 | +console.log("10" + "20"); // output ========> 30 |
| 1222 | +``` |
1194 | 1223 | ## Output Based Questions
|
1195 | 1224 |
|
1196 | 1225 | **1. What will be the output**
|
|
0 commit comments