# Uncaught TypeError: velocity.reflect is not a function

**URL:** <https://discourse.processing.org/t/uncaught-typeerror-velocity-reflect-is-not-a-function/19402>\
**Category:** p5.js\
**Created:** [April 4, 2020, 7:15pm UTC](https://discourse.processing.org/t/uncaught-typeerror-velocity-reflect-is-not-a-function/19402 "2020-04-04T19:15:22Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![mike\_ekim1024](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mike_ekim1024/32/8645_2.png) [@mike\_ekim1024](https://discourse.processing.org/u/mike_ekim1024)\
**Post date:** [April 4, 2020, 7:15pm UTC](https://discourse.processing.org/t/uncaught-typeerror-velocity-reflect-is-not-a-function/19402/1 "2020-04-04T19:15:23Z")

</div>

The documentation clearly states there is a Vector.prototype.reflect() method, but does not exist on the object.

[https://p5js.org/reference/#/p5.Vector](https://p5js.org/reference/#/p5.Vector)

I did a console.log(p5.Vector.prototype) and it’s definitely not there.

When creating a new sketch, the p5 version seems to be 0.10.2:

---

<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:** [April 4, 2020, 7:23pm UTC](https://discourse.processing.org/t/uncaught-typeerror-velocity-reflect-is-not-a-function/19402/2 "2020-04-04T19:23:59Z")

</div>

[p5js.org/reference/#/p5.Vector/reflect](http://p5js.org/reference/#/p5.Vector/reflect)

> <https://github.com/processing/p5.js/blob/1.0.0/src/math/p5.Vector.js#L1447-L1450>

---

<div class="post-metadata">

**Author:** ![mike\_ekim1024](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/mike_ekim1024/32/8645_2.png) [@mike\_ekim1024](https://discourse.processing.org/u/mike_ekim1024)\
**Post date:** [April 5, 2020, 2:06am UTC](https://discourse.processing.org/t/uncaught-typeerror-velocity-reflect-is-not-a-function/19402/3 "2020-04-05T02:06:37Z")

</div>

[https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.10.2/p5.js](https://cdnjs.cloudflare.com/ajax/libs/p5.js/0.10.2/p5.js)

There is no reflect() method in this file. Is this an older version?

Repro: go to [p5js.org](http://p5js.org), create a new sketch, and see that reflect() does not exist.

---

<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:** [April 5, 2020, 2:22am UTC](https://discourse.processing.org/t/uncaught-typeerror-velocity-reflect-is-not-a-function/19402/4 "2020-04-05T02:22:29Z")

</div>

## “index.html”:

```auto
<script async src=https://Unpkg.com/p5></script>
<script defer src=sketch.js></script>

```

[Unpkg.com/p5/](http://Unpkg.com/p5/)

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [April 18, 2020, 11:41pm UTC](https://discourse.processing.org/t/uncaught-typeerror-velocity-reflect-is-not-a-function/19402/5 "2020-04-18T23:41:33Z")

</div>

Vector.reflect was added in 1.0.0.

> <https://github.com/processing/p5.js/commit/36121d2af9f61d1a7a9da33e70085b280877d3f1>

[Editor.p5js.org](http://Editor.p5js.org) is using 0.10.2 by default, as you linked, so it doesn’t have that feature.

If you want the web editor upgraded to 1.0.0 by default, consider opening an issue (if you haven’t already):

- [https://github.com/processing/p5.js-web-editor/issues](https://github.com/processing/p5.js-web-editor/issues)

If you just want a 1.0.0 sketch in the web editor, edit your two script links in the sketch index.html file from `0.10.2` to `1.0.0`. Done.

https://editor.p5js.org/jeremydouglass/sketches/6TkqReZq6

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [April 19, 2020, 12:10am UTC](https://discourse.processing.org/t/uncaught-typeerror-velocity-reflect-is-not-a-function/19402/6 "2020-04-19T00:10:11Z")

</div>

> <https://github.com/processing/p5.js-web-editor/issues/1396>
>
> Nature of issue?
> New feature request
> Feature enhancement details:
> Upgrade default template to p5.js 1.0.0 (from 0.10.2)
> Currently creating a new sketch points to p5.js...

---

<div class="post-metadata">

**Author:** ![jeremydouglass](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/jeremydouglass/32/20_2.png) [@jeremydouglass](https://discourse.processing.org/u/jeremydouglass)\
**Post date:** [August 2, 2020, 2:19am UTC](https://discourse.processing.org/t/uncaught-typeerror-velocity-reflect-is-not-a-function/19402/7 "2020-08-02T02:19:29Z")

</div>

Upgrade to 1.0.0 is now being merged and resolved.
