Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
</body>
</html>
 
 function filterFoods(query) {
   var foods = [
      {food: 'Bacon'}, {food: 'Butter'}, {food: 'Chicken'}, {food: 'Cocoa butter'},
      {food: 'Saussages'}, {food: 'Ham'}, {food: 'Duck'}, {food: 'Salmon'},
      {food: 'Fish'}, {food: 'Lamb'}, {food: 'Fries'}, {food: 'Tomatoes'},
      {food: 'Chicken'}, {food: 'Carrot'}, {food: 'Egg'}, {food: 'Avocado'},
      {food: 'Duck'}, {food: 'Hello'}, {food: 'Cheese'}, {food: 'Carrot'},
      {food: 'Potato'}, {food: 'Sweet Potato'}, {food: 'Pineapple'}, {food: 'Peanut'},
  ]
  return foods.filter(function(food) {
    return (new RegExp(query, 'gi')).test(food.food);
  });
}
console.log(
filterFoods('po')
)
Output 300px

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

Dismiss x
public
Bin info
anonymouspro
0viewers