I'm trying to get into javascript and just figure out how how to print statements in the console. I keep getting this error in the google chrome console.
Uncaught SyntaxError: Invalid or unexpected token
my code is
<html>
<script>
console.log(“Hello world!”);
</script>
</html>
I'm sure its something really simple that I'm missing. I wrote the code on the textedit app on mac and then converted it to an html file.
I'm trying to get into javascript and just figure out how how to print statements in the console. I keep getting this error in the google chrome console.
Uncaught SyntaxError: Invalid or unexpected token
my code is
<html>
<script>
console.log(“Hello world!”);
</script>
</html>
I'm sure its something really simple that I'm missing. I wrote the code on the textedit app on mac and then converted it to an html file.
Share Improve this question asked Jun 20, 2017 at 19:19 Alex TAlex T 131 silver badge3 bronze badges 1-
1
Pay attention to what you copy paste. The quotes surrounding
Hello world!
is the problem. Manually type it and see – Kaushal Niraula Commented Jun 20, 2017 at 19:23
2 Answers
Reset to default 2You're using “ and ”, which are not valid quotes in the Javascript language. You should use ' or " instead.
Change
console.log(“Hello world!”);
to
console.log("Hello world!");
“
is not valid. Downside to copy/paste :)
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745614276a4636135.html
评论列表(0条)