Use array join
method.Join
joins the elements of an array into a string, and returns the string. The default separator is comma (,). Here the separator should be an empty string.
var x = [31,31,3,1].join("");
EDIT: To get the result as numeric
const x = +[31,31,3,1].join("");
or
const x = Number([31,31,3,1].join(""));
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…