This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Generator | |
function *gen (num = 4) { | |
for (let i = 0; i < num; i++) { | |
yield i | |
} | |
} | |
const iter = gen(3) | |
console.log(iter.next()) // { value: 0, done: false } | |
console.log(iter.next()) // { value: 1, done: false } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let preprocessor = 'less'; | |
const { src, dest, parallel, series, watch } = require('gulp'); | |
const browserSync = require('browser-sync').create(); | |
const concat = require('gulp-concat'); | |
const uglify = require('gulp-uglify-es').default; | |
const sass = require('gulp-sass'); | |
const less = require('gulp-less'); | |
const autoprefixer = require('gulp-autoprefixer'); | |
const gcmq = require('gulp-group-css-media-queries'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<title>svg</title> | |
<style> | |
svg { | |
width: 100%; | |
height: 100%; | |
border: 2px solid darkolivegreen; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<img src="img/img_x1.jpg" | |
srcset="img/img_x2.jpg 2x img/img_x3.jpg 3x"> | |
<img src="img/img_x1.jpg" | |
srcset="img/img_x2.jpg 500w img/img_x3.jpg 700w img/img_x4.jpg 1000w"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let map = new Map(); | |
map.set('42', 4222); | |
map.set(42, '4222'); | |
map.set(44, '666'); | |
console.log(map.get('42')); // 4222 | |
console.log(map.has('42')); // true | |
console.log(map.has(43)); // false | |
console.log(map.size); // 3 | |
console.log(map); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let people = [ | |
{name: 'Mihail', age: 15, budget: 100}, | |
{name: 'Maria', age: 25, budget: 200}, | |
{name: 'Miron', age: 35, budget: 300}, | |
] | |
people.forEach((person, index, pArr) => { | |
console.log(person) | |
console.log(person.name) | |
console.log(person.age) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<style> | |
[v-cloak] { | |
display: none; | |
} | |
</style> | |
<div id="app" v-cloak> | |
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const names = ['Denis', 'Ivan', 'Maks', 'Olga'] | |
function mapArray(arr, fn) { | |
let res = [] | |
for (let i = 0; i < arr.length; i++) { | |
res.push(fn(arr[i])); | |
} | |
return res; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// ES6 | |
class ProductES { | |
constructor(brand, price, discount) { | |
this.brand = brand; | |
this.price = price; | |
this.discount = discount; | |
} | |
get brand() { | |
return this._brand; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html lang="en"> | |
<head> | |
<meta charset="UTF-8"> | |
<meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
<meta name="viewport" content="width=device-width, initial-scale=1.0"> | |
<title>Promise Error</title> | |
<style>img { | |
max-width: 200px; | |
}</style> |