Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
<script src="http://cdnjs.cloudflare.com/ajax/libs/lodash.js/2.4.1/lodash.min.js"></script>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var a = [
  {name: "Fred", state: "MO", age: 25},
  {name: "Bobby", state: "IL", age: 34},
  {name: "Marcus", state: "MO", age: 22},
  {name: "Jenny", state: "IL", age: 39}
];
// Find people from MO
var ret = [];
for ( var i = 0; i < a.length; i++) {
  if ( a[i].state === "MO") {
    ret.push(a[i]);
  }
}
console.log(ret);
// 1-liner using lo-dash
console.log( _.where(a, {state: "MO"}));
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
meilingerpro
0viewers