60+ JavaScript Interview Questions
⇩
Level: Beginner and, Medium Topics:
➊ Basics about Arrays
➋ Array Properties
➌ Array Methods
➍ Looping through Arrays
➎ Array related Operators
➏ Common Array Operations
➐ Comparison of Terms
➊ Basics about Arrays
➀ Describe an Array from JavaScript perspective.
➁ What is Array Literal?
➂ Explain about +ve and -ve indexes in an Array.
➃ What is Array's type?
➄ What is an Array-Like object?
➅ Which Array operations can be done on an Array-Like object?
➆ What is a sparse array and, a dense array?
➇ How to detect a sparse array?
➈ How is a sparse array formed?
➉ Describe the looping behaviour for a sparse array.
➋ Array Properties
➀ How to find the size of an array?
➁ How to create an array of a given size?
➂ Is the array in JavaScript static-sized or dynamic-sized?
➃ Is "length" a mutable property?
Or,
➃ 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?
➌ Array Methods
➀ Which methods of Array.prototype accepts -ve 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
➃ find if an array has an element that matches a condition
➄ fetch an element using negative index
➅ insert multiple elements at the end of an array
➆ insert multiple elements at the starting of an array
➇ remove multiple elements at the starting of an array
➈ remove multiple elements at the end of an array
➉ insert multiple elements at an index after removing multiple elements from the same index
➀➀ populate all indexes with the same value
➀➁ retrieve a sub-array between 2 indices
➀➂ copy an array
➀➃ convert an array-like object to array
➍ Looping through Arrays
➀ 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.
➂ How is a sparse array looped? Describe for different looping methods.
➎ Array related 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.
➏ Common Array 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 flat()
➇ Merge 2 or, more arrays using spread operator syntax
➈ Find the sum of all elements in an array using reduce()
➉ Shuffle elements of an array
➐ Comparison of Terms
Mention the difference between
➀ "Array()" and "new Array()"
➁ Single 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()
🚥 Disclaimer
⬘ Few questions covered here are already shared by me.
⬗ Don't assume that only these types of questions are asked during interviews.
⬙ For interviews, you should have fundamentals strong. And you should be able to provide solutions to practical problems.
Hey 👋
I am a Tech Writer, Educator, and Mentor from India 🇮🇳, here sharing
✅ Tutorials
✅ Tricks
✅ Career Tips
✅ Cheat Sheets
✅ Project Ideas
✅ Roadmaps
on
➠ Web Development
➠ Data Structures and Algorithms
➠ Databases
Thanks for reading. 🙏