Skip to content

Instantly share code, notes, and snippets.

@creaux
Last active September 1, 2015 10:37
Show Gist options
  • Save creaux/94322484acb84ffe020a to your computer and use it in GitHub Desktop.
Save creaux/94322484acb84ffe020a to your computer and use it in GitHub Desktop.
//
// Get all values from object
//
var obj = { something: "value1", somethingElse: "value2" };
// Object.keys method
// https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/keys
// Put all keys from object to array
//
// Object.map method
// Iterate over object and creates new object
var arr = Object.keys(obj).map(function(key) {
return obj[key]
});
console.log(arr);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment