# Error: Unexpected string variable

**URL:** <https://phaser.discourse.group/t/error-unexpected-string-variable/7385>\
**Category:** Phaser 3\
**Created:** [September 9, 2020, 5:56pm UTC](https://phaser.discourse.group/t/error-unexpected-string-variable/7385 "2020-09-09T17:56:04Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![AresWarrior](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@AresWarrior](https://phaser.discourse.group/u/AresWarrior)\
**Post date:** [September 9, 2020, 5:56pm UTC](https://phaser.discourse.group/t/error-unexpected-string-variable/7385/1 "2020-09-09T17:56:05Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![BlunT76](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/blunt76/32/1454_2.png) [@BlunT76](https://phaser.discourse.group/u/BlunT76)\
**Post date:** [September 9, 2020, 6:06pm UTC](https://phaser.discourse.group/t/error-unexpected-string-variable/7385/2 "2020-09-09T18:06:51Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![AresWarrior](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@AresWarrior](https://phaser.discourse.group/u/AresWarrior)\
**Post date:** [September 9, 2020, 8:01pm UTC](https://phaser.discourse.group/t/error-unexpected-string-variable/7385/3 "2020-09-09T20:01:05Z")

</div>

Uncaught SyntaxError: Unexpected string

---

<div class="post-metadata">

**Author:** ![AresWarrior](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@AresWarrior](https://phaser.discourse.group/u/AresWarrior)\
**Post date:** [September 9, 2020, 8:01pm UTC](https://phaser.discourse.group/t/error-unexpected-string-variable/7385/4 "2020-09-09T20:01:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jjcapellan](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/jjcapellan/32/542_2.png) [@jjcapellan](https://phaser.discourse.group/u/jjcapellan)\
**Post date:** [September 9, 2020, 8:13pm UTC](https://phaser.discourse.group/t/error-unexpected-string-variable/7385/5 "2020-09-09T20:13:59Z")

</div>

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

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

```

---

<div class="post-metadata">

**Author:** ![AresWarrior](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@AresWarrior](https://phaser.discourse.group/u/AresWarrior)\
**Post date:** [September 10, 2020, 2:05pm UTC](https://phaser.discourse.group/t/error-unexpected-string-variable/7385/6 "2020-09-10T14:05:56Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jjcapellan](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/jjcapellan/32/542_2.png) [@jjcapellan](https://phaser.discourse.group/u/jjcapellan)\
**Post date:** [September 10, 2020, 3:47pm UTC](https://phaser.discourse.group/t/error-unexpected-string-variable/7385/7 "2020-09-10T15:47:40Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![AresWarrior](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@AresWarrior](https://phaser.discourse.group/u/AresWarrior)\
**Post date:** [September 10, 2020, 4:27pm UTC](https://phaser.discourse.group/t/error-unexpected-string-variable/7385/8 "2020-09-10T16:27:25Z")

</div>

It just shows my string variable when I click that.

---

<div class="post-metadata">

**Author:** ![AresWarrior](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@AresWarrior](https://phaser.discourse.group/u/AresWarrior)\
**Post date:** [September 10, 2020, 4:27pm UTC](https://phaser.discourse.group/t/error-unexpected-string-variable/7385/9 "2020-09-10T16:27:34Z")

</div>

var storytext “”;

---

<div class="post-metadata">

**Author:** ![AresWarrior](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@AresWarrior](https://phaser.discourse.group/u/AresWarrior)\
**Post date:** [September 10, 2020, 4:28pm UTC](https://phaser.discourse.group/t/error-unexpected-string-variable/7385/10 "2020-09-10T16:28:11Z")

</div>

Oh, I see the problem.

---

<div class="post-metadata">

**Author:** ![AresWarrior](https://avatars.discourse-cdn.com/v4/letter/a/bbce88/32.png) [@AresWarrior](https://phaser.discourse.group/u/AresWarrior)\
**Post date:** [September 10, 2020, 4:28pm UTC](https://phaser.discourse.group/t/error-unexpected-string-variable/7385/11 "2020-09-10T16:28:27Z")

</div>

I just forgot my operator.
