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
// sleep function | |
function sleep(timeout) { | |
return new Promise(res => setTimeout(res, timeout || 1000)) | |
} | |
// example: | |
(async () => { | |
await sleep(3000); | |
console.log('this code will run after 3 seconds') | |
})() |
This file has been truncated, but you can view the full file.
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 filtered = allWords() | |
// фильтр по длине слова | |
.filter(w => w.length ===5) | |
// фильтр по позиции буквы в слове | |
.filter(w => w[0] === 'д' && w[1] === 'о' && w[3] === 'о') | |
// фильтр по буквам которых НЕ должно быть в слове | |
.filter(w => !(/[иванебютрз]/.test(w))) | |
console.log(filtered, 'filtered'); | |
function allWords() { |