javascript - Concat objects? -


this question has answer here:

i have 2 objects same structure , want concat them using javascript. there easy way this?

var num = { '0': 0, '1': 0, '2': 0, '3': 0 }; var let = { 'a':'1', 'b':'2', 'c':'3' } 

you can use jquery's .extend():

$.extend(num,let); // num merged object. 

note: every duplicate index have value had in let


Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -