Want to receive Question of the Day updates? Subscribe Here
JavaScript Question of the Day
March 31, 2025
IncorrectCorrectNo Answer was selectedInvalid Answer
Consider the following program:
let rect;constWIDTH=50;constHEIGHT=50;functionmain(){drawRects();}functiondrawRects(){for(let i =0; i <20; i++){let randX = Randomizer.nextInt(0,getWidth());let randY = Randomizer.nextInt(0,getHeight());if(i %2==0){createRect(randX, randY,WIDTH+ i,HEIGHT+ i,"black");}}}functioncreateRect(x, y, width, height, color){
rect =newRectangle(width, height);
rect.setPosition(x, y);
rect.setColor(color);add(rect);return rect;}main();