# Weird asynchronous behaviour in p5.js

**URL:** <https://discourse.processing.org/t/weird-asynchronous-behaviour-in-p5-js/38072>\
**Category:** p5.js\
**Created:** [July 24, 2022, 12:39pm UTC](https://discourse.processing.org/t/weird-asynchronous-behaviour-in-p5-js/38072 "2022-07-24T12:39:05Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![glv](https://yyz2.discourse-cdn.com/flex036/user_avatar/discourse.processing.org/glv/32/18785_2.png) [@glv](https://discourse.processing.org/u/glv)\
**Post date:** [July 24, 2022, 2:04pm UTC](https://discourse.processing.org/t/weird-asynchronous-behaviour-in-p5-js/38072/3 "2022-07-24T14:04:57Z")

</div>

Hello @M1ke,

This topic may be of interest:

> [@Printing a Vector before and after changing it produces unexpected results](https://discourse.processing.org/t/printing-a-vector-before-and-after-changing-it-produces-unexpected-results/32111/1):
>
> I’m putting together a short exercise for my students on p5.Vector and its operations. The output of the code below surprises me, and I was hoping someone could explain what’s going on. I’ve been programming in Processing for years, but am new to p5.js, and so my unexpected results might have more to do with how javascript works (or how objects work, or how console output works). Here is the code, along with comments indicating the expected results: function setup() { let h = new p5.Vector(3…

`:)`

---

_[View the full topic](https://discourse.processing.org/t/weird-asynchronous-behaviour-in-p5-js/38072)._
