When an alert()
method is in double quotes it behaves like a string, meaning when it is printed in the console, the console screen shows the alert()
. But i want, when there is an alert()
in console.log()
, to show an alert box. I have written the following piece of code but it does not fulfill my requirements:
var msg="alert("welcome")"
console.log(msg)
When I run the above code, the output to the console is alert("welcome")
and no alert box is created. Could anyone help me figure out how to show an alert box?
Thanks