Skip to content

Instantly share code, notes, and snippets.

@NickSlash
Created May 10, 2026 21:48
Show Gist options
  • Select an option

  • Save NickSlash/c153365a58bee162ef1f026363e67281 to your computer and use it in GitHub Desktop.

Select an option

Save NickSlash/c153365a58bee162ef1f026363e67281 to your computer and use it in GitHub Desktop.
concatenate array of integers into an integer.
let src = [1,23,4,5];
console.log(src.reduce((a, v) => a * ( 10 ** ((Math.floor(Math.log10(v))) + 1) ) + v))
// [ 1, 23, 4, 5 ] -> 12345
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment