I think this is as good as time to say I have no idea why putting the brackets “[ ]” at some places changes how the bracket positioning effects how the code looks after being executed so I tend to open it and stuff everything else in to finishing up the rest of the code. I’d like some help on that and also with my issue when printing out the chess board in the console log ( details to that below)
Triangle Loop
var num_row=7;
for(var row=0; row<num_row; row++)
{var toPrint="#";
for(var column=0; column < row; column++) toPrint+="#";
console.log(toPrint+"\xa0"+ “to”)}
FizzBuzz
for(num=1;num<=100; num++){
if(num%3==0&&num%5==0) console.log(“fizzbuzz”)
else if (num%3==0)console.log(“fizz”)
else if(num%5==0)console.log(“buzz”)
else console.log(num);}
ChessBoard
var chess=""
var size=8,c;
for (var x=0; x<size;x++) {c=x%2==0 ? " #":"# " ;
for (var y=0; y<size/2;y++)
chess+=c;
chess+= “\n”;
console.log(chess)}
I was reminded of the need to work from top down and learned about the remainder operator with the chess board exercise I learned about the conditional operator one issue though with printing this in the console log it gradually increased like the looping triangle did until it made the chessboard why did it not just print out the chessboard ?