+ 24
What type of data is array in JavaScript?
Associtive arrays lesson states that when we include names for our array members an array turns into an object. I checked type of my array and it was object in the first place. So what is the difference between these types? https://www.sololearn.com/learn/JavaScript/1242/ https://code.sololearn.com/WzAgCLh7FHfH/?ref=app
4 Antworten
+ 13
Good question.
Everything in JavaScript is object.
Object with numeric keys is Array.
The Object.prototype is on the top of the prototype inheritance chain:
Array objects inherit from Object.prototype.
Array is iterative and has special Array method, such as forEach.
Readings :
https://developer.mozilla.org/en-US/docs/Web/JavaScript/Inheritance_and_the_prototype_chain
https://www.w3schools.com/js/js_object_prototypes.asp
https://www.sololearn.com/post/57108/?ref=app
https://code.sololearn.com/Wyr76080kKxS/?ref=app
Their are several good Array methods tutorial in
https://code.sololearn.com/WKKkpq0efxai/?ref=app
and also
https://code.sololearn.com/WopAH9yrs62D/?ref=app
in
https://code.sololearn.com/WKFF4vOCr3mi/?ref=app
+ 23
Danijel Ivanović and Gordon thank you for your answers and reading material. It took me a while to read and figure everything out. Now I know more. Gordon's answer is more detailed and that's why I mark it the best :-) )
+ 13
Arrays are just a kind of object specialized for storing sequences of things.😉
+ 13
Dron Solarice 👍
You are welcome, I'm really glad this material helped you 📚... 🤓
And yes 💪Gordon is amazing! 🍻