Skip to content

Instantly share code, notes, and snippets.

@rocktimsaikia
Last active March 11, 2021 06:27
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save rocktimsaikia/cd537dcbcb27fe63f613432a740ac63e to your computer and use it in GitHub Desktop.
Invert an array of integers
// 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