...しかし、コンソールで関数を呼び出すと、未定義が返されます。私は JavaScript の初心者なので、おそらく基本的な間違いを犯している可能性があります。誰かが私を助けてくれれば幸いです:-)。
コードは次のとおりです。
var randomPrint = function(){
x = Math.floor(Math.random() * 100);
y = Math.floor(Math.random() * 100);
z = Math.floor(Math.random() * 100);
console.log(x, y, z);
if(x > y && x > z)
{
console.log("The greatest number is" + " " + x);
}
else if(y > z && y > x)
{
console.log("The greatest number is" + " " + y);
}
else if(z > y && z > x)
{
console.log("The greatest number is" + " " + z);
}
};
randomPrint();