- Courses
- 💻Programming Languages
- 🌐JavaScript
- Core Objects
- Associative arrays
Associative arrays in JavaScript
By Enrico Hochkoeppler
Web Developer & TutoriaLibre Founder
Also called dictionaries.
Associative arrays are not supported by default, but they can by:
- creating empty arrays
- adding elements to the array with named indexes
This procedure will convert the arrays into objects.
Example:
var person = [];
person["name"] = "John";
person["age"] = 39;
However, this procedure is not safe and not recommended. It is recommended to use objects instead of associative arrays.
Found this helpful? Share the knowledge...
... or support this project to keep it alive!
Previous
Arrays
Next
Math
