# Token Error: Colors

**URL:** <https://discourse.processing.org/t/token-error-colors/36000>\
**Category:** Beginners\
**Created:** [March 29, 2022, 5:29pm UTC](https://discourse.processing.org/t/token-error-colors/36000 "2022-03-29T17:29:09Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![throwaway](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@throwaway](https://discourse.processing.org/u/throwaway)\
**Post date:** [March 29, 2022, 5:29pm UTC](https://discourse.processing.org/t/token-error-colors/36000/1 "2022-03-29T17:29:09Z")

</div>

Here is my code

```auto
/*eslint-env es6*/
const button = document.querySelector('button')
const body = document.querySelector('body')
const colors = getRandomColor()

body.style.backgroundColor = 'violet'
button.addEventListener('click', changeBackground)

function changeBackground(){
const colorIndex= parseInt(Math.random()colors.length)
body.style.backgroundColor = colors[colorIndex]
}

```

I keep getting the message of ERROR: Parsing error: Unexpected token colors. I don’t know exactly what I’m doing wrong or how to fix it, I’ve tried many other sources to try and solve the issue but I can’t find any solution. Any ideas?

---

<div class="post-metadata">

**Author:** ![SomeOne](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/someone/32/8639_2.png) [@SomeOne](https://discourse.processing.org/u/SomeOne)\
**Post date:** [March 29, 2022, 6:07pm UTC](https://discourse.processing.org/t/token-error-colors/36000/2 "2022-03-29T18:07:13Z")

</div>

> [@throwaway](#):
>
> `Math.random()colors.length`

You have a syntax error here. Should it be Math.random(colors.length)?

---

<div class="post-metadata">

**Author:** ![throwaway](https://avatars.discourse-cdn.com/v4/letter/t/f475e1/32.png) [@throwaway](https://discourse.processing.org/u/throwaway)\
**Post date:** [March 30, 2022, 11:27am UTC](https://discourse.processing.org/t/token-error-colors/36000/3 "2022-03-30T11:27:02Z")

</div>

Thank you so much! It worked perfectly 🙂
