Skip to content

Instantly share code, notes, and snippets.

@rupeshtiwari
Last active June 21, 2017 20:33
Show Gist options
  • Save rupeshtiwari/3b7d20a893853b1dd944393386c9a14a to your computer and use it in GitHub Desktop.
Save rupeshtiwari/3b7d20a893853b1dd944393386c9a14a to your computer and use it in GitHub Desktop.
const f = a => b => c => a+b+c;
const result = f(1)(2)(3);
console.log(result);
//---------------------------------------
const one = document.getElementById('one');
const two = document.getElementById('two');
const three = document.getElementById('three');
const f = a => b => c => a.addEventListener(b, (event)=>{
event.target.style.backgroundColor= c;
});
const result = f(one)('click')('red');
//---------------------------------
const one = document.getElementById('one');
const two = document.getElementById('two');
const three = document.getElementById('three');
const f = a => b => c => a.addEventListener(b, (event)=>{
event.target.style.backgroundColor= c;
});
const oneEventColor = f(one);
const twoEventColor = f(two);
oneEventColor('mouseover')('blue');
twoEventColor('mouseout')('green');
//-------------------------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment