Build a Pyramid Generator - Build a Pyramid Generator

Tell us what’s happening:

function pyramid(char,count){
for(let i = 1 ; i <= num ; i++){
const space = " ".repeat(count - i);
const row = char.repeat(2 * i - 1);
console.log(${space}${row}${space})
}
}

Your code so far

function pyramid(char,count){
  for(let i = 1 ; i <= num ; i++){
    const space = " ".repeat(count - i);
    const row = char.repeat(2 * i - 1);
    console.log(`${space}${row}${space}`)
  }
}

Your browser information:

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

Challenge Information:

Build a Pyramid Generator - Build a Pyramid Generator

Please Tell us what’s happening in your own words.

Learning to describe problems is hard, but it is an important part of learning how to code.

Also, the more you say, the more we can help!

Tell us what’s happening:

il n ya que l etape 1 qui fonctionne j aimerais savoir pourquoi alors j ai besoin d aide voici mon code:
function pyramid(char,count){
for(let i = 1 ; i <= num ; i++){
const space = " ".repeat(count - i);
const row = char.repeat(2 * i - 1);
console.log(${space}${row}${space})
}
}

Your code so far

function pyramid(char,count){
  for(let i = 1 ; i <= num ; i++){
    const space = " ".repeat(count - i);
    const row = char.repeat(2 * i - 1);
    console.log(`${space}${row}${space}`)
  }
}

Your browser information:

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

Challenge Information:

Build a Pyramid Generator - Build a Pyramid Generator

I went ahead and combined your posts for you. In the future, just reply to the original thread to add further updates.

Thank you. What errors are you seeing in the console when you check your code?

What does Test #2 say?

le test 2, 3,et 4 affiche erreur

Have you tried to log the result of the function like indicated in the tests 3 & 4 ? For example, console.log(pyramid("o", 4, false)

You have on line 2 :

what is num ? Is it defined ?

You also should add a way to react if the 3rd parameter is true :

  1. When the third argument is true the pyramid should have the vertex facing downwards.

(from user stories)