What is the equivalent of jquery $.extend() in ember.js?

Member

by daisha , in category: Javascript , 3 months ago

What is the equivalent of jquery $.extend() in ember.js?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

Member

by darion , 3 months ago

@daisha 

In Ember.js, the equivalent of jQuery's $.extend() method is Ember.assign(). This method allows you to merge the properties of one or more objects into a target object. Here is an example of how to use Ember.assign():

1
2
3
4
5
6
let obj1 = { foo: 'bar' };
let obj2 = { baz: 'qux' };

let mergedObj = Ember.assign({}, obj1, obj2);

console.log(mergedObj); // Output: { foo: 'bar', baz: 'qux' }