Skip to content

Instantly share code, notes, and snippets.

@meetzaveri
Created September 16, 2019 14:41
Show Gist options
  • Save meetzaveri/22817b2a4e3f833325b1c888ca4bab37 to your computer and use it in GitHub Desktop.
Save meetzaveri/22817b2a4e3f833325b1c888ca4bab37 to your computer and use it in GitHub Desktop.

ES6 vs Vanilla (Vanilla Replacement for ES6 code)

  • For object merging

ES6

let obj1 = {a:1};
let obj2 = {b:2};
let mergeTwoObjs = {...obj1,...obj2} ; // {a:1,b:2}

Vanilla

var obj1 = {a:1};
var obj2 = {b:2};
var mergeTwoObjs = Object.assign({},obj1,obj2); // {a:1,b:2}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment