- Home /

# Javascript 2d array Help

I need to input 10 integers between 1-10 and type square in a way that each frame contains one digit.

for example input 3 integers should be like this: 11111 12221 12321 12221 11111

Here is my code:

```
var intNum = prompt("insert number"){
while (intNum <= 0 || intNum > 10){
document.write("Please choose number between 1-10");
}
var unuM = intNum * 2 -1;
var matrix[][] = [unuM][unuM];
for ( var i - 0; i < intNum; i++){
for (int j = 0; j < unuM; j++){
if (matrix[j][i] == 0){
matrix[j][i] = i + 1;
}
if (matrix[unuM - 1 - j][unuM - 1 -i] == 0){
matrix[unuM - 1 - j][unuM - 1 - i] = i + 1;
}
if (matrix[i][j] == 0) {
matrix[i][j] = i + 1;
}
if (matrix[unuM - 1 - i][unuM - 1 - j] == 0){
matrix[unuM - 1 -i][unuM - 1 -j] = i +1;
}
}
}
for (var i = 0; i < unuM; i++){
for ( var j - 0; j < unuM; j++){
document.write(matrix[i][j]);
}
}
}
```

Can someone detect my error?

thanks!

### Your answer

### Welcome to Unity Answers

The best place to ask and answer questions about development with Unity.

To help users navigate the site we have posted a site navigation guide.

If you are a new user to Unity Answers, check out our FAQ for more information.

Make sure to check out our Knowledge Base for commonly asked Unity questions.

If you are a moderator, see our Moderator Guidelines page.

We are making improvements to UA, see the list of changes.

### Follow this Question

### Related Questions

Javascript 2D arrays: null values and slicing 1 Answer

Public 2D array, accessed through the editor ?? 3 Answers

For values in array 2 Answers

Is this considered bad coding 1 Answer