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
| How to reverse all word plcae-in string, | |
| let str = "Hello JavaScript World"; | |
| const checks = str.split(" "); | |
| const reverse= checks.reverse().join(" "); | |
| console.log(reverse); | |
| >>> "World JavaScript Hello" |
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
| Flattening an array in JS. | |
| Ex: Input : [[1, 2, 3], 4, [5, [6, 7]] | |
| Output: [1, 2, 3, 4, 5, 6, 7] | |
| ::: Using concat() ::: | |
| let list = [[1, 2, 3], 4, [5, [6, 7]]; | |
| let flat_array= []; |