Skip to content

Instantly share code, notes, and snippets.

@OlehRovenskyi
OlehRovenskyi / es6.js
Created August 6, 2017 13:25
JavaScript2015
// ---- let const ----
const a = 5;
let b = 10;
if (true) {
let a = 1;
let b = 2;
const c = 3;
console.log(a, b); // 1 2
@OlehRovenskyi
OlehRovenskyi / examples.js
Last active August 12, 2017 20:47
GOF Patterns
// ---- Module ----
// есть проблема в том что все свойства типа public, нет инкапсуляции
var counter = {
counter: 0,
incrementCounter: function () {
return ++this.counter;
},
resetCounter: function () {
return this.counter = 0;
}
{
"todos": [
{
"id": 1,
"title": "buy bread",
"completed": true
},
{
"id": 2,
"title": "buy milk",