I’m on the very basic Javascript tasks and I’m trying to print 3 lines of stars (*) so that they make a pyramid. The given solution is simply:
console.log(" * “);
console.log(” *** “);
console.log(”*****");
Which is fine, obviously that works, but I was trying to get a little more fancy with it. Here’s what I was trying to do (attached picture)
It nearly works, but it won’t print the variable defined as a single *. Instead it displays [object window]. I’ve tried googling what this means but all it gives me is information about the Window Object and I’m not sure if that’s the same thing. Anyway, I know there’s obviously a simpler solution (the three console.log lines) that works just fine, but at this point I’m just trying to learn why my way didn’t work. Any help would be appreciated. Thanks!