RosettaCodeData/Task/Loops-Break/JavaScript/loops-break-3.js

15 lines
272 B
JavaScript
Raw Permalink Normal View History

2016-12-05 22:15:40 +01:00
console.log(
(function streamTillInitialTen() {
var nFirst = Math.floor(Math.random() * 20);
if (nFirst === 10) return [10];
return [
nFirst,
Math.floor(Math.random() * 20)
].concat(
streamTillInitialTen()
);
})().join('\n')
);