Skip to content

Commit a76f207

Browse files
committed
update
1 parent bc35f79 commit a76f207

10 files changed

+158
-40
lines changed

README.md

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ a = "Hello";
4949
console.log(a); // "Hello";
5050
```
5151
##
52-
[Back to Top](#javascript-basics)
52+
[Back to Top](#javascript-most-asked-interview-questions)
5353

5454
### Q2. What are the different datatypes in JavaScript? (Most asked)
5555

@@ -67,7 +67,7 @@ console.log(a); // "Hello";
6767
- Object
6868
- Date
6969
##
70-
[Back to Top](#javascript-basics)
70+
[Back to Top](#javascript-most-asked-interview-questions)
7171

7272
### Q3. What is Hoisting in JavaScript? (Most asked)
7373
- In other scripting/server side languages, variables or functions must be declared before using it.
@@ -81,7 +81,7 @@ console.log(a); // "Hello";
8181
- let and const - Hoisted but not initialized. (Temporal dead zone).
8282
- class declarations - Hoisted but not initialized.
8383
##
84-
[Back to Top](#javascript-basics)
84+
[Back to Top](#javascript-most-asked-interview-questions)
8585

8686
### Q4. What is temporal dead zone ?
8787
- It is a specific time period in the execution of javascript code where the variables declared with let and const exists but cannot be accessed until the value is assigned.
@@ -95,7 +95,7 @@ function somemethod() {
9595
}
9696
```
9797
##
98-
[Back to Top](#javascript-basics)
98+
[Back to Top](#javascript-most-asked-interview-questions)
9999

100100
### Q5. What are the differences let, var and const ? (Most asked)
101101

@@ -112,7 +112,7 @@ function somemethod() {
112112
- `let` and `const` are hoisted to the top of the block scope but do not get assigned any value (temporal dead zone).
113113

114114
##
115-
[Back to Top](#javascript-basics)
115+
[Back to Top](#javascript-most-asked-interview-questions)
116116

117117
### Q6. List out some key features of ES6. (Most asked)
118118

@@ -129,7 +129,7 @@ function somemethod() {
129129

130130
👉 **Interview Tip:** Explain these features with these simple definitions to make good use of 2-3 minutes of interview time.
131131
##
132-
[Back to Top](#javascript-basics)
132+
[Back to Top](#javascript-most-asked-interview-questions)
133133

134134
### Q7. What are limitations of arrow functions in javascript ?
135135
- Arrow functions are introduced in ES6. They are simple and shorter way to write functions in javascript.
@@ -140,7 +140,7 @@ function somemethod() {
140140
- Arrow functions cannot be used as generator functions.
141141
- 👉 **Note:** Arrow functions + this combination questions will be asked here. Please explore on this combinations.
142142
##
143-
[Back to Top](#javascript-basics)
143+
[Back to Top](#javascript-most-asked-interview-questions)
144144

145145
### Q8. What’s the spread operator in javascript ?
146146
Spread operator is used to spread or expand the elements of an iterable like array or string into individual elements.
@@ -165,7 +165,7 @@ let a = […x] // 1,2
165165
```
166166
- **👉 Interview Tip**: Practice the above examples mentioned and showcase them in interviews to make interviewer think that you are a practical person. 😉
167167
##
168-
[Back to Top](#javascript-basics)
168+
[Back to Top](#javascript-most-asked-interview-questions)
169169

170170
### Q9. What is rest operator in javascript ?
171171
- Rest operator is used to condense multiple elements into single array or object.
@@ -177,7 +177,7 @@ let a = […x] // 1,2
177177
Example(1,2,3,4);
178178
```
179179
##
180-
[Back to Top](#javascript-basics)
180+
[Back to Top](#javascript-most-asked-interview-questions)
181181

182182
- It is introduced in Es6.
183183
- It allows us to assign the object properties and array values to distinct variables.
@@ -195,7 +195,7 @@ const [a,b] = [1,2];
195195
console.log(a,b) // 1,2
196196
```
197197
##
198-
[Back to Top](#javascript-basics)
198+
[Back to Top](#javascript-most-asked-interview-questions)
199199

200200
### Q10. What are the differences between Map and Set ?
201201

@@ -243,7 +243,7 @@ let data = new Set();
243243
Sushant
244244
```
245245
##
246-
[Back to Top](#javascript-basics)
246+
[Back to Top](#javascript-most-asked-interview-questions)
247247
### Q11. What are modules in javascript ?
248248
- Modules allows us to break down the large piece of code into smaller parts.
249249
- Modules helps us to write more reusable and maintenable code.
@@ -280,14 +280,14 @@ In Pass by reference, parameters passed as an arguments does not creates their o
280280
console.log(arr); // Output: [1, 2, 3, 4]
281281
```
282282
##
283-
[Back to Top](#javascript-basics)
283+
[Back to Top](#javascript-most-asked-interview-questions)
284284

285285
### Q13. What is the difference between map and filter ? (Frequently asked)
286286
- Both map and filter are useful in JavaScript when working with an arrays.
287287
- map transforms each element of an array and creates a new array which contains the transformed elements. whereas filter will creates a new array with only those elements which satisfies the specified condition.
288288

289289
##
290-
[Back to Top](#javascript-basics)
290+
[Back to Top](#javascript-most-asked-interview-questions)
291291

292292
### Q14. What is the difference between map() and forEach() (Frequently asked)
293293
- map method is used to transform the elements of an array. Whereas forEach method is used to loop through the elements of an array.
@@ -312,7 +312,7 @@ numbers.forEach((number) => {
312312
```
313313

314314
##
315-
[Back to Top](#javascript-basics)
315+
[Back to Top](#javascript-most-asked-interview-questions)
316316

317317
### Q15. What is the difference between for-in and for-of ?
318318
Both for-in and for-of are used to iterate over the datastructure.
@@ -353,7 +353,7 @@ for (let fruit of fruits) {
353353
```
354354

355355
##
356-
[Back to Top](#javascript-basics)
356+
[Back to Top](#javascript-most-asked-interview-questions)
357357

358358
### Q16. What is difference between find vs findIndex ?
359359
**find:**
@@ -385,7 +385,7 @@ for (let fruit of fruits) {
385385
2
386386
```
387387
##
388-
[Back to Top](#javascript-basics)
388+
[Back to Top](#javascript-most-asked-interview-questions)
389389

390390
### Q17. What is the difference between Pure and Impure functions?
391391
**Pure Functions:**
@@ -411,7 +411,7 @@ console.log(greeting("Sushant Sharma"));
411411
```
412412

413413
##
414-
[Back to Top](#javascript-basics)
414+
[Back to Top](#javascript-most-asked-interview-questions)
415415
### Q18. What are the differences between call(), apply() and bind() ? (Frequently asked)
416416
- Call method will invoke the function immediately with the given this value and allows us to pass the arguments one by one with comma separator.
417417
- Apply method will invoke the function immediately with given this value and allows us to pass the arguments as an array.
@@ -463,7 +463,7 @@ greetPerson('!')
463463
```
464464

465465
##
466-
[Back to Top](#javascript-basics)
466+
[Back to Top](#javascript-most-asked-interview-questions)
467467
### Q19. What are the different ways to create object in javascript ? (Most asked)
468468
**Object literal :**
469469
```
@@ -503,7 +503,7 @@ let lesson = {
503503
```
504504

505505
##
506-
[Back to Top](#javascript-basics)
506+
[Back to Top](#javascript-most-asked-interview-questions)
507507

508508
### Q20. Whats the difference between Object.keys,values and entries ?
509509
- Object.keys(): This will return the array of keys
@@ -521,7 +521,7 @@ let lesson = {
521521
```
522522

523523
##
524-
[Back to Top](#javascript-basics)
524+
[Back to Top](#javascript-most-asked-interview-questions)
525525

526526
### Q21. Whats the difference between Object.freeze() vs Object.seal()
527527
**Object.freeze:**
@@ -564,7 +564,7 @@ let lesson = {
564564

565565

566566
##
567-
[Back to Top](#javascript-basics)
567+
[Back to Top](#javascript-most-asked-interview-questions)
568568
### Q22. What is generator function in javascript ?
569569
A generator function is a function which can be paused and resumed at any point during execution.
570570
They are defined by using function* and it contains one or more yield expressions.
@@ -588,7 +588,7 @@ function* generatorFunction() {
588588
```
589589

590590
##
591-
[Back to Top](#javascript-basics)
591+
[Back to Top](#javascript-most-asked-interview-questions)
592592
### Q23. What is IIFE ?
593593
IIFE means immediately invoked function expression.
594594
functions which are executed immediately once they are mounted to the stack is called iife.
@@ -599,7 +599,7 @@ They does not require any explicit call to invoke the function.
599599
})()
600600
```
601601
##
602-
[Back to Top](#javascript-basics)
602+
[Back to Top](#javascript-most-asked-interview-questions)
603603

604604
### Q24. What is CORS ? (Most asked)
605605
👉 **Interview Tip:** This defination is more than enough so prepare this below answer well.
@@ -609,7 +609,7 @@ cors works by adding specific http headers to control which origins have access
609609
Good Reference: https://dev.to/lydiahallie/cs-visualized-cors-5b8h
610610

611611
##
612-
[Back to Top](#javascript-basics)
612+
[Back to Top](#javascript-most-asked-interview-questions)
613613
### Q25. What are the difference between typescript and javascript ?
614614
- Typescript is the superset of javascript and has all the object oriented features.
615615
- Javascript is a dynamically typed language whereas typescript is a statically typed language.
@@ -622,7 +622,7 @@ Good Reference: https://dev.to/lydiahallie/cs-visualized-cors-5b8h
622622

623623

624624
##
625-
[Back to Top](#javascript-basics)
625+
[Back to Top](#javascript-most-asked-interview-questions)
626626

627627
### Q26. What is authentication vs authorization ? (Most asked)
628628

@@ -635,20 +635,20 @@ Good Reference: https://www.youtube.com/watch?v=7Q17ubqLfaM
635635

636636

637637
##
638-
[Back to Top](#javascript-basics)
638+
[Back to Top](#javascript-most-asked-interview-questions)
639639
### Q27. What are the differences between null and undefined ?
640640
**Null:**
641641
If we assign null to a variable, it means it will not have any value
642642
**Undefined:**
643643
means the variable has been declared but not assigned any value yet.
644644

645645
##
646-
[Back to Top](#javascript-basics)
646+
[Back to Top](#javascript-most-asked-interview-questions)
647647

648648
### Q28. What is the difference between == and === in javascript ?
649649
== will check for equality of values where as === willl check for equality as well as datatypes.
650650
##
651-
[Back to Top](#javascript-basics)
651+
[Back to Top](#javascript-most-asked-interview-questions)
652652

653653
### Q29. Slice vs Splice in javascript ? (Most helpful in problem solving)
654654
**Slice:**
@@ -670,7 +670,7 @@ If we want to add/delete/replace the existing elements in the array, then we wil
670670
console.log(newArr); // [3,4,5,0]
671671
```
672672
##
673-
[Back to Top](#javascript-basics)
673+
[Back to Top](#javascript-most-asked-interview-questions)
674674

675675
### Q30. What is setTimeOut in javascript ?
676676
setTimeOut is used to call a function or evaluate an expression after a specific number of milliseconds.
@@ -685,7 +685,7 @@ console.log("Prints Hello after 2 seconds")
685685

686686

687687
##
688-
[Back to Top](#javascript-basics)
688+
[Back to Top](#javascript-most-asked-interview-questions)
689689

690690
### Q31. What is setInterval in javascript ?
691691
setInterval method is used to call a function or evaluate an expression at specific intervals.
@@ -697,7 +697,7 @@ setInterval(function(){
697697
👉 **Interview Tip:** Most asked in output based and problem solving so learn syntax more. Practice some examples.
698698

699699
##
700-
[Back to Top](#javascript-basics)
700+
[Back to Top](#javascript-most-asked-interview-questions)
701701
### Q32. What are Promises in javascript ?
702702
👉 **Interview Tip:** When this is asked cover all below points so that he will not ask any other question on promises 😈.
703703
Promise is an object which represents the eventual completion or failure of an asynchronous operation in javascript.
@@ -721,12 +721,12 @@ let promise = new Promise((res, rej) => {
721721
promise.then(res => console.log(res)).catch(rej => console.log(rej))
722722
```
723723
##
724-
[Back to Top](#javascript-basics)
724+
[Back to Top](#javascript-most-asked-interview-questions)
725725
### Q33. What is a callstack in javascript ?
726726
- Callstack will maintain the order of execution of execution contexts.
727727

728728
##
729-
[Back to Top](#javascript-basics)
729+
[Back to Top](#javascript-most-asked-interview-questions)
730730

731731
### Q34. What is a closure ? (Most asked in all the interviews 99% chance)
732732
Defination: A function along with its outer environment together forms a closure
@@ -805,4 +805,4 @@ function createPerson(name) {
805805
};
806806
}
807807
```
808-
[Back to Top](#javascript-basics)
808+
[Back to Top](#javascript-most-asked-interview-questions)

async.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
// console.log("hii")
88

99

10+
1011
// function fetchData(callback) {
1112
// setTimeout(() => {
1213
// callback("Hello")

coding_series/10_ele_arr.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
// Write a JavaScript program that prints the elements of the following array.
2+
const arr = [[1, 2, 1, 24], [8, 11, 9, 4], [7, 0, 7, 27], [7, 4, 28, 14], [3, 10, 26, 7]];
3+
4+
//using nested loop
5+
6+
for (let i = 0; i < arr.length; i++) {
7+
console.log(`row ${i}`)
8+
for (let j = 0; j < arr[i].length; j++) {
9+
console.log(`${arr[i][j]}`)
10+
}
11+
}
12+
13+
// using for each method
14+
15+
arr.forEach((row, i) => {
16+
console.log(`row ${i}`);
17+
row.forEach(value => {
18+
console.log(value);
19+
});
20+
});

coding_series/11_sum_of_squares.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
// Write a JavaScript program to find the sum of squares of a numerical vector.
2+
const arr = [0, 1, 2, 3, 4]
3+
4+
// using reduce method
5+
const sumOfSquares = arr.reduce((acc, val) => acc + (val * val), 0)
6+
console.log(sumOfSquares)
7+
8+
// using loop method
9+
10+
let sum = 0;
11+
for (const num of arr) {
12+
let num_sqr = num * num
13+
sum = sum + num_sqr
14+
}
15+
console.log(sum)

coding_series/12_sum_prod_arr.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Write a JavaScript program to compute the sum and product of an array of integers.
2+
3+
const arr = [1, 2, 3, 4, 5, 6]
4+
5+
// using reduce method
6+
const result = arr.reduce((acc, val) => {
7+
return {
8+
sum: acc.sum + val,
9+
prod: acc.prod * val
10+
};
11+
}, { sum: 0, prod: 1 });
12+
13+
console.log(result);
14+
15+
// using loop method
16+
17+
let sum = 0;
18+
let prod = 1;
19+
for (const num of arr) {
20+
sum = sum + num;
21+
prod = prod * num;
22+
}
23+
console.log(`sum is ${sum} and Product is ${prod}`)

0 commit comments

Comments
 (0)