Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. ["0|0", "0|1", "0|2", "0|3", "0|4"]
  2. ["1|0", "1|1", "1|2", "1|3", "1|4"]
  3. ["2|0", "2|1", "2|2", "2|3", "2|4"]
  4. ["3|0", "3|1", "3|2", "3|3", "3|4"]
  5. ["4|0", "4|1", "4|2", "4|3", "4|4"]
  6.  
  7. ["4|0", "4|1", "4|2", "4|3", "4|4"]
  8. ["3|0", "3|1", "3|2", "3|3", "3|4"]
  9. ["2|0", "2|1", "2|2", "2|3", "2|4"]
  10. ["1|0", "1|1", "1|2", "1|3", "1|4"]
  11. ["0|0", "0|1", "0|2", "0|3", "0|4"]
  12.  
  13. function createGrid(rowCount, columnCount) {
  14. for (let x = 0; x < rowCount; x++) {
  15. for (let y = 0; y < columnCount; y++) {
  16. cell(x, y);
  17. }
  18. }
  19. }
  20.  
  21. function cell(x, y) {
  22. grid[x] = grid[x] || [];
  23. grid[x][y] = x + "|" + y;
  24. }
  25.  
  26. var grid = [];
  27. createGrid(5, 5);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement