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
| // Решение 1 | |
| function reverse(string) { | |
| return string.split('').reverse().join(''); | |
| } | |
| for (let character of string) { | |
| reversed = character + reversed; | |
| } | |
| return reversed; |
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
| git commit --amend -m "Сообщение без ошибок" |
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 x = [[1,2,[3]],4]; | |
| const flat = (arr) => { | |
| if (Array.isArray(arr)) { | |
| return arr.reduce((prev,curr) => { | |
| return prev.concat(flat(curr)); | |
| }, []); | |
| } else { | |
| return arr; | |
| } | |
| } |
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 array = [1, 2, 3, 5, 1, 5, 9, 1, 2, 8]; | |
| Array.from(new Set(array)); |
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
| [...Array(10).keys()] |
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 {host, href, protocol} = window.location; | |
| console.log(host); | |
| console.log(href); | |
| console.log(protocol); |