# Strange access to data class

**URL:** https://discourse.processing.org/t/strange-access-to-data-class/40063
**Category:** Beginners
**Created:** [December 8, 2022, 11:22am UTC](https://discourse.processing.org/t/strange-access-to-data-class/40063 "2022-12-08T11:22:26Z")
**Posts on this page:** 1
**Showing post:** 6

<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 8, 2022, 12:32pm UTC](https://discourse.processing.org/t/strange-access-to-data-class/40063/6 "2022-12-08T12:32:28Z")

</div>

> [@gaspard](#):
>
> , the values are correct but I don’t understand the behavior…

Both outputs in my browser got the expected values: `[1, 2, 3]` & `[3, 1, 2]`.

But b/c you’re printing an array, if a browser by chance delays the actual printing to the console, it’s possible that you’ll see the array’s most current values for all outputs.

As a workaround you can extract the arrays values when printing it using the spread `...` syntax:  
`console.log(...myTest.groupe);`

> **[Spread syntax (...) - JavaScript | MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Spread_syntax)**
>
> The spread (...) syntax allows an iterable, such as an array or string, to be expanded in places where zero or more arguments (for function calls) or elements (for array literals) are expected. In an object literal, the spread syntax enumerates the...

---

_[View the full topic](https://discourse.processing.org/t/strange-access-to-data-class/40063)._
