Reputation: 13
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.
Upvotes: 1
Views: 6116
Reputation: 106
You're using “ and ”, which are not valid quotes in the Javascript language. You should use ' or " instead.
Upvotes: 2
Reputation: 1
Change
console.log(“Hello world!”);
to
console.log("Hello world!");
“
is not valid. Downside to copy/paste :)
Upvotes: 2