Tell us what’s happening:
every time i try it gives this explain
2. Your first console.log should come after your return keyword.
3. Your second console.log should come before your return keyword.
i wrote everything but i didnt reach the true ans
Step 60
Below the return
statement, log the string "This works!"
to the console.
After doing that, you will see that the string "This works!"
does not display in the console, and the console.log("This works!")
line is greyed out.
Copy the console log and paste it above the return
statement. Now, the string "This works!"
should appear in the console.
An important thing to know about the return
keyword is that it does not just define a value to be returned from your function, it also stops the execution of your code inside a function or a block statement. This means any code after a return
statement will not run.
Your code so far
const character = "#";
const count = 8;
const rows = [];
// User Editable Region
function padRow(name) {
const test = "Testing";
return test;
}
// User Editable Region
const call = padRow("CamperChan");
console.log(call);
for (let i = 0; i < count; i = i + 1) {
rows.push(character.repeat(i + 1))
}
let result = ""
for (const row of rows) {
result = result + row + "\n";
}
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/133.0.0.0 Safari/537.36 Edg/133.0.0.0
Challenge Information:
Learn Introductory JavaScript by Building a Pyramid Generator - Step 60