Introduction
ES6 - Spread Operator

ES6 - Spread Operator

var state  = {'veg': 'potato'}

//All Same
state = $.extend({}, state, {'fruit': 'apple'}) // jQuery
state = Object.assign({}, state, {'fruit': 'apple'}) // JS
state = { ...state, 'fruit': 'apple'} //ES6 Spread operator

Notice the above code it does the same thing. Spread operator is an easy to use syntax for object/array manipulation

Author

Vetrichelvan Jeyapalpandy

12 years of experience in web development. Javascript enthusiast. Performance is an important trait of any website, so trying to improve that wherever possible.

View Comments
Next Post

React Tips - return statement with parentheses

Previous Post

Link to SMS from your web site/app with pre-filled msg