I am just trying to use alert and put a string variable inside the alert and get an error:
Uncaught TypeError: Property \'alert\' of object [Object Window] i
Adding to Chris's answer... I had mistakenly overrode alert in my own function!
//Don't do this:
function alertOrConsole(node, alert){
if(alert){
alert(node);
}else{
console.log(node);
}
}
//----------------------------
//Fixed:
function alertOrConsole(node, flag){
if(flag){
alert(node);
}else{
console.log(node);
}
}