Tell us what’s happening:
I am so beyond stuck on this one it is making me want to tear my hair out. I have the correct length of the string printed and can’t figure out how to insert the \n line breaks where I need them to be, any help is greatly appreciated.
Your code so far
function pyramid(str, number, bool)
{
let space = " ";
if(bool === false)
{
let repeatedStr = (str.repeat(number * number))
console.log(repeatedStr);
let newString = "\n" + space.repeat(number) + repeatedStr.slice(0, 1)
console.log(newString)
for(let i = 0; i < repeatedStr.length; i++)
{
}
}
}
console.log(pyramid("o", 3, false));
console.log("\n o\n ooo\nooooo")
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/140.0.0.0 Safari/537.36
Challenge Information:
Build a Pyramid Generator - Build a Pyramid Generator
https://www.freecodecamp.org/learn/full-stack-developer/lab-pyramid-generator/lab-pyramid-generator