Eloquent JS Book: First exercise

Hi all, I’m attending the JavaScript course, just the first chapters. I work as a graphic, basically converting files from PSD to HTML/CSS and then into a WordPress theme, so zero JavaScript knowledge. And I found myself more below the average of programmers :sweat_smile: and feeling a bit lost…

Anyway I tried the first exercise of the Eloquent JavaScript book, and I had to look at the solution to solve it (after many many tries) After a couple of days of rest I tried again and I solved it but in a different way, maybe not the ideal one, but without using a .length function but the != operator…

Here below the code, feel free to correct or comment it.

Good JS to all :muscle: Have fun :computer:

Write a loop that makes seven calls to console.log to output the following
triangle:
#
##
###
####
#####
######
#######
*/

for (triangle = "#"; triangle != "#######"; triangle = triangle + "#"){
  console.log(triangle);
}
2 Likes