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
| {"version":1,"resource":"file:///Users/home/Desktop/work/frontend/apps/website/Content/j/i18n/translations/lang.en.json","entries":[{"id":"ygHx.json","timestamp":1755509692514}]} |
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 countTime = (queue, windowsCount) => { | |
| if (windowsCount >= queue.length) return Math.max(...queue) | |
| const windowsArr = new Array(windowsCount).fill(0) | |
| for (let i = 0; i < queue.length; i++) { | |
| const minValue = Math.min(...windowsArr) | |
| const minValueIndex = windowsArr.findIndex(value => value === minValue) | |
| const idx = i >= windowsCount ? minValueIndex : i |
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 reverseInt = (num) => { | |
| const reverseNum = Math.abs(num).toString().split('').reverse().join(''); | |
| return num < 0 ? '-' + reverseNum : reverseNum; | |
| } | |
| reverseInt(-2578); |
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 getFirstHalfNumber = (ticket) => { | |
| const half = ticket.length / 2; | |
| const number = ticket.slice(0, half); | |
| let sum = 0; | |
| for (let i = 0; i < half; i += 1) { | |
| sum += Number(number[i]); | |
| } |
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 counter = (count => () => count++)(1); | |
| counter(); | |
| counter(); | |
| // function counter() { | |
| // if (counter.n === undefined) { | |
| // counter.n = 1; | |
| // } else { | |
| // counter.n += 1; |
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 convertBinaryToDecimal = arr => ( | |
| arr.reduce((acc, current, index) => ( | |
| acc + current * Math.pow(2, arr.length - index - 1) | |
| ), 0) | |
| ); | |
| convertBinaryToDecimal([1,1,1,1,1,1,1,1]); |
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 where = document.createElement('div'); | |
| where.innerHTML = ` <div></div>123abc<p></p>dsak*&^&^!@`; | |
| const deleteTextNodes = (where) => ( | |
| [...where.childNodes].filter(node => { | |
| console.log('####node', node.nodeName); | |
| return node.nodeType === 1; | |
| }) |
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 getArr = (arr1, arr2) => { | |
| if (!arr1.length || !arr2.length) { | |
| return []; | |
| } | |
| const set1 = new Set(arr1); | |
| const set2 = new Set(arr2); | |
| console.log([...set1]); |
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 magic = (...rest) => { | |
| const sum = rest.reduce((acc, current) => acc + current, 0); | |
| const inner = (...args) => { | |
| return magic(inner.valueOf(), ...args); | |
| }; | |
| inner.valueOf = () => sum; | |
| return inner; | |
| }; |
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
| // Добавьте всем функциям в прототип метод defer(ms), который возвращает обёртку, откладывающую вызов функции на ms миллисекунд. | |
| // Например, должно работать так: | |
| // function f(a, b) { | |
| // alert( a + b ); | |
| // } | |
| // f.defer(1000)(1, 2); // выведет 3 через 1 секунду. | |
| // Пожалуйста, заметьте, что аргументы должны корректно передаваться оригинальной функции. | |
| // http://learn.javascript.ru/native-prototypes#tasks | |
NewerOlder