How to convert an array of integers to a single digit

let’s say I have got an array of [2, 4, 5, 6].

I want to be able to convert it to 2456.

Is there an easy and elegant way to do this in JavaScript?

I am aware of this question.

Answer

Using Array#join:

const arr = [2, 4, 5, 6];

const str = arr.join('');

console.log('string', str);
console.log('number', +str);