我想了解为什么这两段代码不提供相同的输入,为什么第一块返回'undefined'?在While循环中调用函数
var myFunction = function() {
Math.floor(Math.random() * 2);
};
while(myFunction === 0){
console.log("Test");
myFunction();
}
console.log("Return");
第二件:
var myFunction = Math.floor(Math.random() * 2);
while(myFunction === 0){
console.log("Test");
myfunction = Math.floor(Math.random() * 2);
};
console.log("Return");
你从哪里返回一个函数?我没有看到任何函数中的任何return语句。 – abhishek