How do I join this array to give me expected output in as few steps as possible?
var x = [31,31,3,1] //expected output: x = 313131;
Your question asks for a number, most of the answers above are going to give you a string. You want something like this.
const number = Number([31,31,3,1].join(""));