3/33 console.log is not a function


#1

The TypeError keeps saying: console.log is not a function. This is my code.

for (var i = 1; i <= 20; i++) {
if ((i %3 === 0 && i%5 === 0)) {
console.log("FizzBuzz");
}
else if (i %5 === 0) {
console.log("Buzz");
}
else if ( i %3 === 0) {
console.log("Fizz");
}
else {
console.log(i);
}
};


#2

Wild guess.

You might have done something like:

console.log = 5
console.log()

Refreshing the page will restart the js session which means that console.log will refer to the function it's supposed to again

And.. if it says x is not a function, then find out what x is! Print it out, or whatever one does to inspect things in javascript. Check type and stuff.


#3

Thanks, once I refreshed the page, the code worked correctly.