Skip to content

Instantly share code, notes, and snippets.

View pavel-lens's full-sized avatar

pavel-lens pavel-lens

  • Ether
View GitHub Profile
@pavel-lens
pavel-lens / declarative-cycle.js
Created January 3, 2017 18:20
Declarative (functional) style programming example
const array = [1, 2, 3, 4, 5];
const array2 = array.map((value) => value * 2);
console.log(array2); // [ 2, 4, 6, 8, 10 ]
@pavel-lens
pavel-lens / imperative-cycle.js
Last active January 3, 2017 18:20
Imperative-style programming in Javascript
const array = [1, 2, 3, 4, 5];
for (let i=0; i < array.length; i++) {
array[i] = array[i] * 2;
}
console.log(array); // [ 2, 4, 6, 8, 10 ]