Tell us what’s happening:
Why is it specifically giving me an error to use const. when i can do this with let. it doesnt say in the questinon that i need to use the const. Am i missing something or is it just best practice use to const when storing return value of a function
Question : To see the result of calling your padRow
function, declare a call
variable and assign your existing padRow
call to that variable.
Error: “Sorry, your code does not pass. Keep trying.
You should use const
to declare your call
variable.”
Your code so far
const character = "#";
const count = 8;
const rows = [];
function padRow() {
}
// User Editable Region
let call=padRow();
// User Editable Region
for (let i = 0; i < count; i = i + 1) {
rows.push(character.repeat(i + 1))
}
let result = ""
for (const row of rows) {
result = result + "\n" + row;
}
console.log(result);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/126.0.0.0 Safari/537.36
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 49