Last active
November 2, 2022 05:42
-
-
Save hemedani/8d206eab3268175693bb8dc809e43047 to your computer and use it in GitHub Desktop.
create number from an array
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
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