Error Alert | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Error Alert

When I type the code below the alert box does not pop up. <html> <head> <title></title> <script type="text/javascript"> alert("This is an alert box!"); </script> </head> <body> </body> </html> If I copy the exact same code and paste it below the code the alert box works perfectly. When I write it once I get this error : SyntaxError: expected expression, got '<' Line: 4 Anyone know what's going wrong?

25th Oct 2017, 5:41 AM
Marcus Davenport
Marcus Davenport - avatar
1 Answer
+ 3
This code works as is, without any error message ^^ And anyway, the error message copied doesn't rely on this code, because there's no "Line: 4" in the Js script source: maybe you have typo mistake in your original making it not working (and maybe line 4 error is related to something in the JS tab, if you was testing this in code playground)... but try again, this alert box pop-up at first run of the code ;P
25th Oct 2017, 6:00 AM
visph
visph - avatar