// Create the hashmap
var animal = {};
// Add keys to the hashmap
animal[‘cat’] = { sound: ‘meow’, age:8 };
animal[‘dog’] = { sound: ‘bark’, age:10 };
animal[‘bird’] = { sound: ‘tweet’, age:2 };
animal[‘cow’] = { sound: ‘moo’, age:5 };
I'm using the code above to try and create a hashmap. My question is, where sound and age are placed, how would I place them in using a variable.
For example
var one = 'sound';
var two = 'age';
animal['cat'] = {one: 'meow', two: 9};