Skip to content

Instantly share code, notes, and snippets.

@hemedani
Created November 2, 2022 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hemedani/06885fd74e273c2f598777828d973f72 to your computer and use it in GitHub Desktop.
Save hemedani/06885fd74e273c2f598777828d973f72 to your computer and use it in GitHub Desktop.
create number from an array
const arr = [5, 6, 5, 4, 7, 8];
const nums = arr.map((number, index, arr) => number * 10 ** (arr.length - 1 - index));
console.log("the final number is ", nums);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment