This file contains hidden or 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 userCollection = [ | |
{ | |
name: 'Дмитрий', | |
age: 35 | |
}, | |
{ | |
name: 'Сергей', | |
age: 30 | |
} | |
] |
This file contains hidden or 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
/** | |
* поставит в очередь Callback Queue стразу | |
*/ | |
setTimeout(() => { | |
console.log('setTimeout', 1); | |
}, 0) | |
setTimeout(() => { | |
console.log('setTimeout', 2); | |
}, 0) |
This file contains hidden or 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
var aList = ['A','B','C','D','E']; | |
/** | |
* | |
* @param {Array} arr | |
* @return {Generator} | |
*/ | |
function* cycle(arr) { | |
const arr = [...arr]; | |
let i = 0; |
This file contains hidden or 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 collection = [1, 2, 3, 4, 5, 6, null, undefined, 7, 8, 9, 10]; | |
collection = collection.filter(a => !!a); | |
let max = (prev, current)=> { | |
return prev > current ? prev : current; | |
} | |
let min = (prev, current)=> { | |
return prev < current ? prev : current; | |
} |
This file contains hidden or 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
/** | |
* | |
* @param data | |
* @returns {string} | |
*/ | |
let myTemplate = function(data){ | |
let text = ` | |
If you are {full_name} a value (and not a regular expression), | |
only the first {name} of the value will be replaced. | |
To replace all occurrences of a specified value, use the global (g) modifier (see "More Examples" below). |
This file contains hidden or 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
if (!Function.prototype.bind) { | |
Function.prototype.bind = function(oThis) { | |
if (typeof this !== 'function') { | |
// ближайший аналог внутренней функции | |
// IsCallable в ECMAScript 5 | |
throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); | |
} | |
var aArgs = Array.prototype.slice.call(arguments, 1), | |
fToBind = this, |
This file contains hidden or 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 polindrom = 'Я не !! , !!!стар, брат Сеня'; | |
let polindromPrepare = ''; | |
let comparePolindrom = ''; | |
function compose(...funcs) { | |
return [].reduceRight.bind(funcs, (prev, func) => func(prev)); | |
} | |
This file contains hidden or 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
// Display: | |
// appearance | |
// box-align | |
// box-flex | |
// box-sizing | |
// box-orient | |
// box-pack | |
// display-box | |
// overflow-sroll | |
// user-select |