Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
var categories = ["Adventure", "Strategy"];
var items = [
  {
    title: "Star Wars",
    categories: ["Adventure"]
  }, {
    title: "Star Search",
    categories: ["Adventure", "Strategy"]
  }, {
    title: "Star Trek",
    categories: ["Adventure", "Family"]
  }, {
    title: "Star Wars",
    categories: ["Family", "Strategy"]
    }
];
var filterred = items.filter(function(i) {
  return categories.every(function(c) {
    return i.categories.indexOf(c) >= 0
  })
})
console.log(filterred)
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers