• The questions covered here are mostly conceptual
• I do not claim only these type of questions are/should be asked during interviews
• For interviews, you should have fundamentals strong. And you should be able to provide solutions to practical problems.
✪ What is an Array?
✪ What is Array Literal?
✪ Explain about indexes and negative indexes in an Array?
✪ What does typeof return for an array?
✪ What is an Array-Like object? Give some examples.
✪ What operations of an Array can be done on an Array-Like object?
2️⃣ Properties
✪ How to find size of an array?
✪ How to create an Array of a given size?
✪ Is array in JavaScript static sized or, dynamic sized?
✪ Is "length" a mutable property?/Can "length" of an Array be changed manually?
✪ What does happen when "length" is reduced?
✪ What will happen when "length" is increased?
✪ How to remove elements from the end of an array by manipulating the "length" property?
3️⃣ Methods
✪ Which methods of Array.prototype accepts negative indexes?
✪ How to do deep level flat operation?
✪ Which method will you use?
⇨ To find the first element of an array that matches a condition
⇨ To find if an array has an element that matches a condition
⇨ To fetch an element using negative index
⇨ To insert multiple elements at the end of an array
⇨ To insert multiple elements at the starting of an array
⇨ To remove multiple elements at the starting of an array
⇨ To remove multiple elements at the end of an array
⇨ To insert multiple elements at an index after removing multiple elements from the same index
⇨ To populate all indexes with the same value
⇨ To retrieve a sub-array from an index to an index
⇨ To copy an array
⇨ To convert an array-like object to array
4️⃣ Looping
✪ Between for...in and for...of, which is more suitable for an Array to loop through?
✪ Mention all Array.prototype methods which loop through the array.
✪ Can you loop an array which is just created using Array(n)?
5️⃣ Operators
✪ What is destructuring assignment for arrays?
✪ What is rest parameter inside destructuring assignment?
✪ Which is valid? [a, b, ...c], [a, ...b, c]
✪ Explain how spread operator operates.
✪ Swap 2 numbers using Array Destructuring.
6️⃣ Common Operations
✪ Insert an element into an array at starting/ending/any position by not mutating the original.
✪ Update an element of an array at starting/ending/any position by not mutating the original.
✪ Delete an element from an array at starting/ending/any position by not mutating the original.
✪ Insert and delete an element into/from an array at starting/ending/any position by using splice()
✪ Create a copy of an array using spread operator syntax.
✪ Merge 2 or, more arrays using concat()
✪ Merge 2 or, more arrays using spread operator syntax
✪ Find sum of all elements in an array using reduce()
✪ Shuffle elements of an array.
✪ Sort elements of an array using a custom defined order.
7️⃣ Comparison
✪ Mention the difference between
⇨ "Array()" and "new Array()"
⇨ Single parameter Array() and Multiple parameter Array()
⇨ Array.of() and Array.from()
⇨ find() and filter()
⇨ findIndex() and indexOf()
⇨ includes() and some()
⇨ some() and every()
⇨ map() and flatMap()
⇨ slice() and splice()
⇨ forEach() and map()
⇨ forEach() and for...of
⇨ shift() and pop()
⇨ unshift() and push()
⇨ reduce() and reduceRight()
The next 🧵 of this series will provide questions from
1️⃣ String
In addition to JavaScript, I have shared Interview Questions on few other subjects (SQL, DSA, Python, HTML, React, GIT) More coming in future.
For your convenience, I organised all these questions 🧵 in a "Twitter Moment". If you are interested, check 👇
• The questions covered here are mostly conceptual
• I never claim only these type of questions are/should be asked during interviews
• For interviews, you should have fundamentals strong. And you should be able to provide solutions to practical problems.
• The questions covered here are mostly conceptual
• I never claim only these type of questions are/should be asked during interviews
• For interviews, you should have fundamentals strong. And you should be able to provide solutions to practical problems.
💙 Spread and Rest Parameter Operators (...) in JavaScript
Follow this 🧵 for the easiest and never-to-forget type explanation. Thank me later 😝
Happy Weekend 👋
👇👇👇
🤷♀️ What is the need? [The Background]
We all know that an array is a collection of elements "kept together" in memory in a contiguous manner so that we can easily access any element using an index.
⇨ As all elements were kept together, how can we break those apart?
🤷♀️ Why does an array need to be broken apart?
If elements of an array are going to be "treated separately", you have to take all them out. Let's take an example.
🤷♀️ Problem: Print all elements in an array separately.
✅ Solution: