# How to deduce p5.js version?

**URL:** <https://discourse.processing.org/t/how-to-deduce-p5-js-version/12993>\
**Category:** Gallery\
**Created:** [July 26, 2019, 7:06am UTC](https://discourse.processing.org/t/how-to-deduce-p5-js-version/12993 "2019-07-26T07:06:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![grege2](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/grege2/32/3069_2.png) [@grege2](https://discourse.processing.org/u/grege2)\
**Post date:** [July 26, 2019, 7:06am UTC](https://discourse.processing.org/t/how-to-deduce-p5-js-version/12993/1 "2019-07-26T07:06:58Z")

</div>

This is a rhetorical question, I have already solved it. I thought I’d publish my method.

I’ve proposed to p5.js on more than one occasion that an accessible release number would be useful, but they seem very reluctant to do that.

So, here’s my method. Hope it helps somewhere.

```auto
  if(typeof deltaTime === "number" ) p5version = "0.9.0 or later";    
  else if (typeof resetShader === "function") p5version = "0.8.0";
  else if (typeof circle === "function") p5version = "0.7.3";
  else p5version = "0.7.2 or earlier" 

```

---

<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:** [July 28, 2019, 9:55pm UTC](https://discourse.processing.org/t/how-to-deduce-p5-js-version/12993/2 "2019-07-28T21:55:50Z")

</div>

Thanks for sharing this!

Should the “0.8.0” and “0.7.3” be given as ranges as well?

> [@grege2](#):
>
> I’ve proposed to p5.js on more than one occasion that an accessible release number would be useful

Is there an open issue / feature request?

- [Issues · processing/p5.js · GitHub](https://github.com/processing/p5.js/issues)

---

<div class="post-metadata">

**Author:** ![grege2](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/grege2/32/3069_2.png) [@grege2](https://discourse.processing.org/u/grege2)\
**Post date:** [July 28, 2019, 10:55pm UTC](https://discourse.processing.org/t/how-to-deduce-p5-js-version/12993/3 "2019-07-28T22:55:39Z")

</div>

Hi Jeremy,

I think the 0.8.0 and 0.7.3 are precise. Those features were introduced at those revs. The test runs from the top down, and tries to find the latest rev it can be. “0.9.0 or later” is just there because 0.9.1, 0.10.0 etc. might have further distinguishing features but we don’t know them yet. “0.7.2 or earlier” is just because I didn’t bother to progress further back. I have some code that runs properly at 0.7.3, but breaks at 0.8.0 or later, and also needs features not available at 0.7.2, and I like to have a warning in it about that. (I can’t make the time at present to update that code). The 0.8.0 to 0.9.0 transition has not broken anything for me, which is great.

Re. open issues, here’s the main one, which produced some useful discussion, but didn’t progress.

> <https://github.com/processing/p5.js/issues/2525>

Rgds, GE.

---

<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:** [July 29, 2019, 5:34am UTC](https://discourse.processing.org/t/how-to-deduce-p5-js-version/12993/4 "2019-07-29T05:34:37Z")

</div>

Ah, I see. Because there is no eg 7.4 or 7.5 release, these aren’t ranges. Got it!

---

<div class="post-metadata">

**Author:** ![grege2](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/grege2/32/3069_2.png) [@grege2](https://discourse.processing.org/u/grege2)\
**Post date:** [July 29, 2019, 5:54am UTC](https://discourse.processing.org/t/how-to-deduce-p5-js-version/12993/5 "2019-07-29T05:54:41Z")

</div>

Yup. Sorry, I should have mentioned that. Ciao.
