Skip to content

Instantly share code, notes, and snippets.

@h2ospace
Created March 14, 2013 19:39
Show Gist options
  • Save h2ospace/5164493 to your computer and use it in GitHub Desktop.
Save h2ospace/5164493 to your computer and use it in GitHub Desktop.
underscore: keys, values, invert, has, isstring
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Underscore</title>
<script src="underscore-min.js"></script>
</head>
<body>
<script>
(function() {
var x;
var user = {
name: 'taguchi',
score: 80,
web: 'http://dotinstall.com'
};
x = _.keys(user);
x = _.values(user);
x = _.invert(user);
x = _.has(user, "name");
// isEmpty, isString, isNull, isNumber
x = _.isString(user.score);
console.log(x);
})();
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment