Learn Introductory JavaScript by Building a Pyramid Generator - Step 48

Tell us what’s happening:

My code keeps telling me
my padRow function should return the value of the name parameter,
please tell me what should i do??

Your code so far

const character = "#";
const count = 8;
const rows = [];


// User Editable Region

  function padRow(name) {
  return "Hello!";
}

// User Editable Region

const call = padRow();
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 + "\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/124.0.0.0 Safari/537.36

Challenge Information:

Learn Introductory JavaScript by Building a Pyramid Generator - Step 48

hello and welcome back to fcc forum :slight_smile:

  • return “name” parameter directly, currently you are returning a string conatining “Hello”

happy coding :slight_smile:

2 Likes

Hello @haxleylona.43.

Welcome back.

Ok so this step appears to be testing one’s ability to identify different parts of a function’s anatomy.

Essentially, a function could contain a name, might or might not contain some parameters and will always contain a body where something will be returned.

A function could like something like this:

function name (parameter1, parameter2, etc...) {
      this is the body
}

The challenge furnishes you with:

function padRow(name) {
  return "Hello!";
}

which return a string at the moment.

You need to amend the return line to return the parameter supplied.

Does this help?

Keep up the good progress!

Happy Coding! :slightly_smiling_face:

2 Likes

I have tried it but it is still not working and keep bringing the same error m error, so i am not sure even what to do

i also need help with this challenge, i tried all the solution provided and i am still getting errors

thankyou so much and i appreciate it

Instructions:
Change your padRow function to return the name parameter directly.

1 Like

yes i have realixed my mistake, thankyou

1 Like

thankyou ad it is good to be back

1 Like

did you figure this one out?i am stumped

yes i did, you should just return the parameter… that is “name” is the parameter so return it and you will pass the step

don’t write name in parenthesis
return name;