# How can I get version constant in p5.js?

**URL:** <https://discourse.processing.org/t/how-can-i-get-version-constant-in-p5-js/28217>\
**Category:** p5.js\
**Created:** [March 3, 2021, 11:33am UTC](https://discourse.processing.org/t/how-can-i-get-version-constant-in-p5-js/28217 "2021-03-03T11:33:15Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)\
**Post date:** [March 3, 2021, 11:33am UTC](https://discourse.processing.org/t/how-can-i-get-version-constant-in-p5-js/28217/1 "2021-03-03T11:33:15Z")

</div>

basically what the title says - for debugging purpose I want to get the version as a constant variable. I checked each variable in “this” but didn’t get anything relevant matches /version/i

```auto
function setup() {
  createCanvas(400, 400);
  console.log(Object.keys(this).filter(s=>s.match(/version/i)))
}

function draw() {
  background(220);
}

```

---

<div class="post-metadata">

**Author:** ![hamoid](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/hamoid/32/58_2.png) [@hamoid](https://discourse.processing.org/u/hamoid)\
**Post date:** [March 3, 2021, 1:00pm UTC](https://discourse.processing.org/t/how-can-i-get-version-constant-in-p5-js/28217/2 "2021-03-03T13:00:39Z")

</div>

By looking at [https://editor.p5js.org/app.f1745ed387a63eb59417.js](https://editor.p5js.org/app.f1745ed387a63eb59417.js) (the js file used by [editor.p5js.org](http://editor.p5js.org)) it seems like 1.1.9 is only shown in two URLs, nowhere in the code.

And it’s in the first line of [https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/p5.js](https://cdnjs.cloudflare.com/ajax/libs/p5.js/1.1.9/p5.js)

> <https://github.com/processing/p5.js/issues/2525>
>
> Nature of issue?
> New feature request
> Most appropriate sub-area of p5.js?
> Core
> Details about the bug:
> p5.js version: 0.5.16
> Web browser and version: Chrome 63.0.3239.108
> Operating...

---

<div class="post-metadata">

**Author:** ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)\
**Post date:** [March 3, 2021, 1:28pm UTC](https://discourse.processing.org/t/how-can-i-get-version-constant-in-p5-js/28217/3 "2021-03-03T13:28:39Z")

</div>

thanks aBe, I didn’t expect to see a long thread without it still is not implemented 😓

---

<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:** [March 3, 2021, 4:52pm UTC](https://discourse.processing.org/t/how-can-i-get-version-constant-in-p5-js/28217/4 "2021-03-03T16:52:29Z")

</div>

> [@micuat](#):
>
> … I want to get the version as a constant variable.

> [@Detect p5 1.1.9 vs 1.0.0?](https://discourse.processing.org/t/detect-p5-1-1-9-vs-1-0-0/22920/2):
>
> I’m also puzzled why devs from both Processing Java & p5js flavors so adamantly refuse to add some way for a sketch to inspect which version it is running on. crazy_face Indeed the p5 constructor doesn’t contain any info about its version. The only place I’ve found it was inside the “p5.js” file itself on its 1st line as a comment block. Take a look at these 2 examples below. 1st is from the current “v1.1.9” and 2nd is from a very old “v.0.2.3”: /\*! p5.js v1.1.9 July 22, 2020 \*/: [cdn.…](http://cdn.JsDelivr.net/npm/p5@1.1.9)

---

<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:** [April 5, 2021, 6:27am UTC](https://discourse.processing.org/t/how-can-i-get-version-constant-in-p5-js/28217/5 "2021-04-05T06:27:15Z")

</div>

Congrats @micuat I see you have got it implemented in p5 1.3.1 as VERSION. Working well for me. That’s taken a long time, the p5 team didn’t see it as important.

---

<div class="post-metadata">

**Author:** ![micuat](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/micuat/32/19407_2.png) [@micuat](https://discourse.processing.org/u/micuat)\
**Post date:** [April 5, 2021, 6:56am UTC](https://discourse.processing.org/t/how-can-i-get-version-constant-in-p5-js/28217/6 "2021-04-05T06:56:18Z")

</div>

thanks 🙂 I mean people have different priorities. I hope this helps (maybe few but) some people!
