I am trying to understand why these two pieces of code do not provide the same input, and why the first piece returns 'undefined'?
var myFunction = function() {
Math.floor(Math.random() * 2);
};
while(myFunction === 0){
console.log("Test");
myFunction();
}
console.log("Return");
Second piece:
var myFunction = Math.floor(Math.random() * 2);
while(myFunction === 0){
console.log("Test");
myfunction = Math.floor(Math.random() * 2);
};
console.log("Return");