Skip to content
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (31 sloc) 893 Bytes


Clone an object

const clone = Object.assign({}, original);

Note: Doesn't do deep cloning. Use lodash or underscore

Iterate keys in an object (

  const object = {x: 'a', y: 'b', z: 'c'}
  for (const key in object) {
    console.log(`${key}: ${object[key]}`);


x: a
y: b
z: c

Iterate values in an object (for...of)

Do not use `(for...of)` with `objects`. This will fatal with:


TypeError: page[Symbol.iterator] is not a function. (In 'page[Symbol.iterator]()', 'page[Symbol.iterator]' is undefined)


Uncaught TypeError: page[Symbol.iterator] is not a function

You can’t perform that action at this time.