Created
March 7, 2021 06:35
-
-
Save sharmaabhinav/5686997f3d94cb92888d5e14adb31833 to your computer and use it in GitHub Desktop.
Sample APIs problems
This file contains 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 map | |
const arr = [2,3,4,5] | |
arr.map((el) => 2 * el) | |
Output = [4,6,8,10] | |
String repeat | |
const city = “ajmer” | |
city.repeat(5) | |
Output = “ajmerajmerajmerajmerajmer” | |
Array reduce | |
const arr = [2,3,4,5] | |
arr.reduce((sum, el) => sum + el) | |
Output = 14 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment