JSFiddle - React, Tailwind, and code Playground
fun snippets...functions and objects
by nickadeemus2002
Babel + JSX
//es5
/*
var addInSequence = function(x){
//closure
return function(y){
return (x + y);
};
};
*/
//es6
const addInSequence = (x) => (y) => (x+y);
//returns a function!
console.log( addInSequence(10)(5) );
function Person(name){
//ensure instance
if( !(this instanceof Person) ){
return new Person(name);
}
this.name = name;
}
var Chris = Person('Chris');
console.log('window', window);