# Unable to create a 2d array

**URL:** <https://forum.makecode.com/t/unable-to-create-a-2d-array/11919>\
**Category:** Help\
**Tags:** javascript\
**Created:** [January 27, 2022, 8:01pm UTC](https://forum.makecode.com/t/unable-to-create-a-2d-array/11919 "2022-01-27T20:01:15Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![jkohlin](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/jkohlin/32/5689_2.png) [@jkohlin](https://forum.makecode.com/u/jkohlin)\
**Post date:** [January 27, 2022, 8:01pm UTC](https://forum.makecode.com/t/unable-to-create-a-2d-array/11919/1 "2022-01-27T20:01:16Z")

</div>

![arcade-Jaga-kanin](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/9/9bd59c39801f1d8b235155d9a356fb07f8094e39.png)  
I have a class called Pixel and I want to create an array holding arrays of Pixel-objects  
I tried tons of stuff but I can’t get it to work. I just get the error that Pixel[][] is not assignable to type number[]  
This is how I instantiate it: `let cols: Pixel[][] = []`

---

<div class="post-metadata">

**Author:** ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)\
**Post date:** [January 28, 2022, 10:47pm UTC](https://forum.makecode.com/t/unable-to-create-a-2d-array/11919/2 "2022-01-28T22:47:19Z")

</div>

Welcome, @jkohlin!

In an empty JavaScript project, this seems to work for me just fine:

```typescript
class Pixel {
}
let cols: Pixel[][] = []

```

Do you perhaps have a previous definition for `cols` somewhere in your code?
