javascript - How to pass an array into a map? Syntax -


i need this:

$('#online-order').wcforms({id: '#online-order', to: 'contact', colors['red']: '#00f' }); 

but there mistake in syntax. please, tell me how must pass it. thanks!

as javascript has no associative arrays, if want way, need use object.

{id: '#online-order', to: 'contact', colors: { red: '#00f'} } 

jsfiddle demo

you can access red property this:

var obj = {id: '#online-order', to: 'contact', colors: { red: '#00f'} };  console.log(obj.colors.red); //or console.log(obj['colors']['red']); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -