Last active
March 11, 2021 06:27
-
-
Save rocktimsaikia/cd537dcbcb27fe63f613432a740ac63e to your computer and use it in GitHub Desktop.
Invert an array of integers
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
// Inverts the integers of an array | |
const invert = arr => arr.map(n => -n); | |
invert([2,-5]); //=> [-2,5] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment