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'} }
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
Post a Comment