Skip to content

Instantly share code, notes, and snippets.

@nola
Created November 26, 2013 01:36
Show Gist options
  • Select an option

  • Save nola/7652088 to your computer and use it in GitHub Desktop.

Select an option

Save nola/7652088 to your computer and use it in GitHub Desktop.
The old school way of setting up an array was to create a named array and then add each named element one by one. A quicker and more readable way is to add the elements at the same time using the object literal notation. Please note that Associative Array are essentially JavaScript Objects with properties.
var skillSet = new Array();
skillSet['Document language'] = 'HTML5';
skillSet['Styling language'] = 'CSS3';
skillSet['Javascript library'] = 'jQuery';
skillSet['Other'] = 'Usability and accessibility';
//short hand version
var skillSet = {
'Document language' : 'HTML5',
'Styling language' : 'CSS3',
'Javascript library' : 'jQuery',
'Other' : 'Usability and accessibility'
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment