# How do I get names from objects instantiated from a class?

**URL:** https://forum.makecode.com/t/how-do-i-get-names-from-objects-instantiated-from-a-class/24283
**Category:** Help
**Created:** [November 15, 2023, 6:06pm UTC](https://forum.makecode.com/t/how-do-i-get-names-from-objects-instantiated-from-a-class/24283 "2023-11-15T18:06:53Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)
#### Post date: [November 15, 2023, 6:06pm UTC](https://forum.makecode.com/t/how-do-i-get-names-from-objects-instantiated-from-a-class/24283/1 "2023-11-15T18:06:53Z")

</div>

Basicaly, writing up an object with properties and fetching its keys with `Object.keys()` works fine.

```js
let foo = {
    bar: "abc",
    baz: () => {}
}

// Logs "bar", "baz"
console.log(Object.keys(foo));

```

However, getting keys from a class instance just yields an empty array

```auto
class Foo {
    bar: number;
    baz() {
        // code goes here
    }
}

// Expecting "bar", "baz"
// Output is empty
console.log(Object.keys(new Foo()));

```

Why is this the case? Is there a way to achieve what I’m trying to do? Please help, I need this for a project. Thanks in advance

---

<div class="post-metadata">

### Author: ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)
#### Post date: [November 16, 2023, 10:06pm UTC](https://forum.makecode.com/t/how-do-i-get-names-from-objects-instantiated-from-a-class/24283/2 "2023-11-16T22:06:35Z")

</div>

I’ve been experimenting with this, as well as sought after help from others and I can’t seem to find a workaround. @richard, is/could this even be possible?

---

<div class="post-metadata">

### Author: ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)
#### Post date: [November 20, 2023, 6:17pm UTC](https://forum.makecode.com/t/how-do-i-get-names-from-objects-instantiated-from-a-class/24283/3 "2023-11-20T18:17:02Z")

</div>

@richard @jwunderl I hate being annoying and constantly mentioning people but I’d really like some help, since this seems like an internal issue. I’m currently working on a project and I’ve hit a brick wall due to this. If there’s a way, please let me know, otherwise tell me it’s impossible so I can move on to a different approach in my project.

I really hate spamming mods but this is a very specific issue related to makecode and it seems that I’ve exhausted all resources that could be helpful. Makecode docs also do not mention this kind of issue.

---

<div class="post-metadata">

### Author: ![jwunderl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jwunderl/32/5308_2.png) [@jwunderl](https://forum.makecode.com/u/jwunderl)
#### Post date: [November 20, 2023, 6:33pm UTC](https://forum.makecode.com/t/how-do-i-get-names-from-objects-instantiated-from-a-class/24283/4 "2023-11-20T18:33:45Z")

</div>

I didn’t see this post, this is one of the differences in our static javascript vs standard javascript listed in [https://makecode.com/language#semantic-differences-against-javascript](https://makecode.com/language#semantic-differences-against-javascript) / not yet supported.

---

<div class="post-metadata">

### Author: ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)
#### Post date: [November 20, 2023, 10:19pm UTC](https://forum.makecode.com/t/how-do-i-get-names-from-objects-instantiated-from-a-class/24283/5 "2023-11-20T22:19:40Z")

</div>

Oh, sorry about that, my bad. I skimmed through the documentation (that page) but I guess I missed that part. Any plans to support this any time soon?
