Error: Unexpected string variable

I’m making a game in which I need to make text appear at the top of the screen, in a specific bubble. I am attempting to do so with the use of string variables, but my console is giving me an error saying that my string variable is unexpected. Please can someone either tell me how to fix this or suggest an alternative to using a string variable if it is a bad idea.

Hi,
Show us some code, or the console error, without it’s hard to help you…

Uncaught SyntaxError: Unexpected string

update(){
var storytext “”;
if (story == 1){storytext = Finally! That took forever!}
}

Hi @AresWarrior,
All string values should be between single or double quotes:

update(){
    var storytext;
    if (story == 1){
        storytext = 'Finally! That took forever!';
    }
}
1 Like

Thanks @jjcapellan for the advice, but it’s still giving me the same errors.

Normally this type of error is produced by bad concatenations of strings, bad use of the quotes,…
If you are using Chrome:

  1. Open the console.
  2. Click on the link which appears at side to the error message.
  3. This should show you the error origin in your source code.

Good luck!

It just shows my string variable when I click that.

var storytext “”;

Oh, I see the problem.

I just forgot my operator.