0

How to make dictionary through JavaScript

suggest me

18th Feb 2017, 9:43 AM
Ayush
Ayush - avatar
2 Respuestas
+ 3
Just do object... var dict = { 'key': 'value', 'answer': 42 }; alert(dict['key']); // output "value" alert(dict.answer); // output 42 dict.key = 'forty two'; dict['answer'] = 0; dict.newkey = "new value"; alert(dict['key']); // output "value" alert(dict.answer); // output 42 alert(dict['newkey']); // output "new value"
19th Feb 2017, 11:38 AM
visph
visph - avatar
0
thanks
20th Feb 2017, 9:51 AM
Ayush
Ayush - avatar