Build a Pyramid Generator - Build a Pyramid Generator

Tell us what’s happening:

I dont understand why (boolean === false) doesnt pass in freecodecamp in visuel code studio it wokrs prefectly put it doesnt pass in freecodecamp can somebdoy help me with a tip where to look?

Your code so far

function pyramid(stringPattern, rows, boolean) {
 let result="\n"
  
  if (boolean === false){
  for(let i=0;i<rows;i++){
    let row = "";
    for(let j=0;j<rows-i;j++){
      row += " " }
      for(let k=0; k<2*i+1; k++){
        row += stringPattern } 
  result += row + `\n` }
 return result} 

   if (boolean === true){
  for(let i=0;i<rows;i++){
    let row = "";
  for(let j=0;j<i;j++){
      row += " "}
    for(let k=0; k<2*(rows-i)-1; k++){
        row += stringPattern } 
  result += row + `\n` }
return result} 
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/144.0.0.0 Safari/537.36 Edg/144.0.0.0

Challenge Information:

Build a Pyramid Generator - Build a Pyramid Generator

Hi @kramertim886

To help you debug, compare the pyramid in user story 3 to the pyramid in user story 4 using console logs.

Happy coding

@Teller That really helped to understand the problem. Thanks for the quick repsonse!

1 Like