How to generate three-digit numbers using js, where each number is an even number?
var a=2*Math.ceil(4*Math.random()) var b=2*Math.floor(5*Math.random()) var c=2*Math.floor(5*Math.random()) console.log(eval(a+''+b+''+c))
Before, I only looked at the content, not the title. The following is the output of all those that meet the requirements
var arr=Array(900).fill(0).map((e,i)=>i+100) .filter(e=>/[2468][24680]{2}/.test(e.toString())) console.log(arr)
for(let i=2; i<=8; i=i+2){ for(let j=0; j<=8; j=j+2){ for(let k=0; k<=8; k=k+2){ console.log("" + i + j + k) } } }
var arr=[0,2,4,6,8]; function randomNum(){ var fistnum=Math.floor(Math.random()*4+1); var secnum=Math.floor(Math.random()*5); var thrnum=Math.floor(Math.random()*5); var num=fistnum*100+secnum*10+thrnum; return num; }
function randomNumber(min,max){
var range = max-min; var rand = Math.random(); var result = min+Math.round(rand*range); return parseInt(result/100) == parseInt((result%100)/10) && (parseInt(result/100) == parseInt(result%10))?parseInt(result/100)%2 == 0 && parseInt((result%100)/10)%2 ==0 && result%10%2== 0?result:0:0;
}
Before, I only looked at the content, not the title.
The following is the output of all those that meet the requirements
function randomNumber(min,max){
}