🚀 Arrays are NOT real arrays in JavaScript.
That was one of the most interesting things I learned today while studying Arrays in JavaScript.
At first, arrays seem simple — just a collection of elements.
But under the hood, JavaScript arrays are actually objects with special behavior, not fixed-size contiguous memory structures like in languages such as C++.
What I learned about Arrays:
• Arrays in JavaScript are mutable
• They can store multiple data types
• They are dynamic in size
Key operations I practiced:
• Adding/removing elements → push(), pop(), shift(), unshift()
• Looping → classic for loop and modern iteration methods
• Searching → indexOf(), lastIndexOf(), includes()
• Manipulation → slice(), splice()
• Conversion → join() (array → string)
• Spread operator → modern and powerful way to copy/merge arrays
One important insight:
The sort() method can behave unexpectedly with numbers because it sorts values as strings by default.
Example:
[10, 2, 5].sort() // Output -> [10, 2, 5]
To sort numbers correctly, we need a comparison function.
To summarize everything, I created a detailed carousel Notes (Notes given by Rohit Negi).
Course Instructor: Rohit Negi | Youtube Channel: Coder Army
#JavaScript #WebDevelopment #LearningJourney #BuildInPublic #FrontendDevelopment #Fullstackdevelopment #Coding
Insightful. One must refer it