Skip to content

Instantly share code, notes, and snippets.

@chrisma
Last active August 29, 2015 14:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chrisma/b7e1c482fc149c2e6ef2 to your computer and use it in GitHub Desktop.
Save chrisma/b7e1c482fc149c2e6ef2 to your computer and use it in GitHub Desktop.
Javascript helper functions
function randomPropertyName(obj) {
var keys = Object.keys(obj)
return keys[ keys.length * Math.random() << 0];
}
function randomPropertyValue(obj) {
var keys = Object.keys(obj)
return obj[keys[ keys.length * Math.random() << 0]];
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment