Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
How to workaround Objects vs arrays in JavaScript for key/value pairs?
Store it like the following −
var players = {
600 : 'Sachin',
300 : 'Brad',
};
For key/ value pairs, we have used the above solution, since we wanted a one-to-one. We did this to use the key as a lookup key. You can also add more values like this −
var players = {
900 : 'Sachin',
300 : 'Brad',
700 : 'Steve',
200 : 'Rahul',
600 : 'Kevin',
500 : 'David',
} Advertisements
