I was trying a very simple thing with javascript, to create a minesweeper grid.
gridsize=9;
//grid initialisation 
var grid=Array(gridsize).fill(Array(gridsize).fill(null));
// this comes from  <https://stackoverflow.com/questions/1527803/generating-random-whole-numbers-in-javascript-in-a-specific-range>
function randint(min, max) {
  return Math.floor(Math.random() * (max - min + 1)) + min;
}
nbombs=20;
insertedbombs=0;
while (insertedbombs<nbombs){
    rx=randint(0,gridsize-1);
    ry=randint(0,gridsize-1);
    if (grid[rx][ry] == null){
        insertedbombs++;
        grid[rx][ry]='b';
    }
}
The while loop hangs, both in Chrome and Firefox consoles, all the values of the grid are filled, not just 20, i've no idea why, i guess i have some wrong understanding of javascript language, because the same code in python works.
Working python code:
grid= [[None for i in range(9)]for i in range(9)]
nbombs=20;
insertedbombs=0;
while (insertedbombs< nbombs):
    rx=random.randint(0,8)
    ry=random.randint(0,8)
    if (grid[rx][ry]== None):
            grid[rx][ry]='b'
            insertedbombs+=1
 
     
    