Skip to content

Instantly share code, notes, and snippets.

@iamshadmirza
Last active November 10, 2019 07:49
Show Gist options
  • Save iamshadmirza/b6ed66d93cc6431487c7eb7b209b5b25 to your computer and use it in GitHub Desktop.
Save iamshadmirza/b6ed66d93cc6431487c7eb7b209b5b25 to your computer and use it in GitHub Desktop.
(function(){
let food = [
{type: 'beverage', name: 'tea'},
{type: 'veg', name: 'aloo paratha'},
{type: 'non-veg', name: 'biryani'},
{type: 'non-veg', name: 'butter chicken'}
];
const filterFunction = (string) => (item) => item.type === string;
let nonVegDishes = food.filter(filterFunction('non-veg'));
console.log(nonVegDishes);
})();
//copy paste in chrome sources
(function(){
function curry(a) {
return function multiply(n) {
if (n) {
a *= n;
return multiply;
} else {
return a;
}
};
}
console.log(curry(2)(2)(2)(2)(2)(2)());
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment