# Javascript Error reporting variable already declared

**URL:** <https://discourse.processing.org/t/javascript-error-reporting-variable-already-declared/16551>\
**Category:** Beginners\
**Created:** [December 21, 2019, 4:34pm UTC](https://discourse.processing.org/t/javascript-error-reporting-variable-already-declared/16551 "2019-12-21T16:34:45Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Dandada](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@Dandada](https://discourse.processing.org/u/Dandada)\
**Post date:** [December 21, 2019, 4:34pm UTC](https://discourse.processing.org/t/javascript-error-reporting-variable-already-declared/16551/1 "2019-12-21T16:34:45Z")

</div>

I created an example of a simply particle system after watching one of Dan Shiffman’s video. However it gives an error “Uncaught SyntaxError: Identifier ‘location’ has already been declared (sketch: line 1)” which make no sense.

Arguments named location have been used in the constructors of both the Particle and ParticleSystem classes however these are local to those classes so I am not sure why it’s reporting that the variable has already been declared. Changing the name of the variable in sketch.js to “loc” solved the problem but shouldn’t be necessary.

The link to the sketch with the error is: [https://editor.p5js.org/learntocodebb/sketches/xGX17bqPA](https://editor.p5js.org/learntocodebb/sketches/xGX17bqPA)

---

<div class="post-metadata">

**Author:** ![GoToLoop](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/gotoloop/32/86_2.png) [@GoToLoop](https://discourse.processing.org/u/GoToLoop)\
**Post date:** [December 21, 2019, 4:58pm UTC](https://discourse.processing.org/t/javascript-error-reporting-variable-already-declared/16551/2 "2019-12-21T16:58:04Z")

</div>

> [@Dandada](#):
>
> error “Uncaught SyntaxError: Identifier ‘location’ has already been declared

- [How to detect openprocessing presence and version, under p5.js - Processing 2.x and 3.x Forum](http://Forum.Processing.org/two/discussion/25891/how-to-detect-openprocessing-presence-and-version-under-p5-js#Item_1)

> **[Window: location property - Web APIs | MDN](https://developer.mozilla.org/en-US/docs/Web/API/Window/location)**
>
> The Window.location read-only property returns a Location object with information about the current location of the document.

---

<div class="post-metadata">

**Author:** ![Dandada](https://avatars.discourse-cdn.com/v4/letter/d/b77776/32.png) [@Dandada](https://discourse.processing.org/u/Dandada)\
**Post date:** [December 21, 2019, 5:06pm UTC](https://discourse.processing.org/t/javascript-error-reporting-variable-already-declared/16551/3 "2019-12-21T17:06:01Z")

</div>

Thank you. I guess I have never named a variable location before. lol
