+ 8
What is the difference
what is the difference between alert and console.log in JavaScript?
4 Answers
+ 12
Alert triggers a (visible) pop-up box while console.log writes in the (secret) console. Go test them....
+ 6
The difference is where the text output occurs ^^
+ 3
alert and console.log are built in javascript functions. alert puts a popup on the screen with a message or a question you ask your user; one can also in an obtrusive way use it for code control. console.log will log in the console(F12 on chrome) whatever you pass to it. use it to check for the return value of a function or to chexk that callbacks work. alert(something) puts something in a popup/ console.log(something) puts something as return value in the development tools browser console. In the console tab.
+ 3
Alert should be shown to the users while consold.log for developers (mostly debugging)