你可以这样做。var values=[];for(let i = 0; i < 5; i++ ) { values.push(Math.floor(Math.random() * 10));}console.log(values); //if you want to print an arrayconsole.log(values.join()); //if you want to print as string with coma seprationconsole.log(values.join(" ")); //if you want to print as string with empty spaces