46
rated 0 times
[
50]
[
4]
/ answers: 1 / hits: 103780
/ 12 Years ago, thu, december 13, 2012, 12:00:00
I'm sick & tired of always having to write code like this:
function shallowExtend(obj1,obj2){
var key;
for ( key in obj2 ) {
if ( obj2.hasOwnProperty(key) === false ) continue;
obj1[key] = obj2[key]
}
}
Or if I don't want to write the code myself, implement a library that does it already. Surely ES6+ is coming to the rescue on this will provide us with something like a Object.prototype.extend(obj2...)
or Object.extend(obj1,obj2...)
So does ES6+ provide such functionality? If not already there, then is such functionality planned? If not planned, then why not?
More From » ecmascript-6