Learn Introductory JavaScript by Building a Pyramid Generator - Step 59

Tell us what’s happening:

My code passed when i updated the return value inside the function,but am still not sure as to why it passed. should the return value not be updated outside the function?

also the second part of the exercise was not clear on how to use the return value captured outside the function.

Your code so far

function padRow(name) {
const test = “Testing”;
return test;
}

Your browser information:

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

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 59

Welcome back to the forum @Kev.R

Values returned out of a function are used by calling the function. You can use the function call directly as the value it returns, or capture the returned value in a variable. This way, you can use the value assigned to a locally scoped variable, outside the function it was created in.

You will assign the function call to a variable in a later step.

Happy coding

@Teller Alright much appreciated.

1 Like