"functional es6"
Bootstrap 3.3.0 Snippet by irinashuvalova

<link href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//maxcdn.bootstrapcdn.com/bootstrap/3.3.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <div class="container"> <div class="row"> <h2>Create your snippet's HTML, CSS and Javascript in the editor tabs</h2> </div> </div>
const a = 'a'; const b = 'b'; const oA = { a } const oB = { b } const c = { ...oA, ...oB } const [t, u] = ['a', 'b']; //const { type, payload } = action; const blep = { blop: 'blop' }; // The following is equivalent to: // const blop = blep.blop; const { blop } = blep; blop; // 'blop' const aTail = (head, ...tail) => tail aTail(1,2,3) const double = x => x * 2 const arr = [1, 2, 3] arr.map(double) const startsWithS = words => { const filtered = []; for (let i = 0, { length } = words; i < length; i++) { const word = words[i]; if (word.startsWith('s')) filtered.push(word); } return filtered; }; startsWithS(['oops', 'gasp', 'shout', 'sun']); // [ 'shout', 'sun' ] const reduce = (reducer, initial, arr) => { // shared stuff let acc = initial; for (let i = 0, length = arr.length; i < length; i++) { // unique stuff in reducer() call acc = reducer(acc, arr[i]); // more shared stuff } return acc; }; reduce((acc, curr) => acc + curr, 0, [1,2,3]); // 6 const filter = ( fn, arr ) => reduce((acc, curr) => fn(curr) ? acc.concat([curr]) : acc, [], arr ); const censor = words => filter( word => word.length !== 4, words ); [2, 4, 6].reduce((acc, n) => acc + n, 0); // 12 const add1ThenDouble = pipe( add1, double ); add1ThenDouble(2); // 6 // ((2 + 1 = 3) * 2 = 6)

Related: See More


Questions / Comments: