join an array of numbers into 1 number in javascript? -
how join array give me expected output in few steps possible?
var x = [31,31,3,1] //expected output: x = 313131;
use array join
method.join
joins elements of array string, , returns string. default separator comma (,). here separator should empty string.
var x = [31,31,3,1].join("");
Comments
Post a Comment