Skip to content

Instantly share code, notes, and snippets.

@hemedani
Last active November 2, 2022 05:42
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/8d206eab3268175693bb8dc809e43047 to your computer and use it in GitHub Desktop.
Save hemedani/8d206eab3268175693bb8dc809e43047 to your computer and use it in GitHub Desktop.
create number from an array
const arr = [5, 6, 5, 4, 7, 8];
let nums = 0;
for (let i = 0; i < arr.length; i++) {
nums = nums * 10 + arr[i];
}
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