Categories
JavaScript Programming

Object

  • Use variable for key in Object
{ [variableName] : someValue }

// Computed property names feature was introduced in ECMAScript 2015 (ES6) that allows you to dynamically compute the names of the object properties in JavaScript object literal notation.

https://stackoverflow.com/questions/11508463/javascript-set-object-key-by-variable

  • Comparison
// Method 1
JSON.stringify(obj1) === JSON.stringify(obj2) 
Order of the properties matter

// Method 2
deepCompare

https://stackoverflow.com/questions/1068834/object-comparison-in-javascript

Leave a comment