Quick question - assume we have these two objects:
var obj={str:'',int:0,bool:false,arr:[]};
var paramObj={str:'Hey',bool:true};
The .extend() function in jQuery works like this: (to my knowledge)
$.extend(obj,paramObj);
// obj={str:'Hey',int:0,bool:true,arr:[]};
But I want something that works like this, but in reverse, like so:
$.extendRev(paramObj,obj);
// paramObj={str:'Hey',int:0,bool:true,arr:[]};
Is there a function like this in the jQuery (or native) language, which merges two objects together, keeping object values in the first object, only adding object values from the second object if they dont already exist in the first.
Or am I going to have to code this out from scratch?
objoverwrite the values inparamObj, which is not what I want.paramObj={str:'Hey',int:0,bool:true,arr:[]};