Learn Basic String and Array Methods by Building a Music Player - Step 15

Tell us what’s happening:

How do you input the return output as assessed? Examples please.

Your code so far

<!-- file: index.html -->

/* file: styles.css */

/* file: script.js */
// User Editable Region

const addTwoNumbers = (a, b) => {
  return a + b;
}

// User Editable Region

Your browser information:

User Agent is: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/18.0.1 Safari/605.1.15

Challenge Information:

Learn Basic String and Array Methods by Building a Music Player - Step 15

Hi there!

You need an implicit return of a + b. The instructions is asking you to remove the return keyword and the function’s curly braces.

Hi there this is my solution however there’s somehow wrong here please provide an example of how this code should look, thanks.

const addTwoNumbers = (a, b) => a + b;

Good, but don’t change the names of the parameters.

You can reset the step to restore the original variable names.

Like this, correct the mistakes here?

const addTwoNumbers = (num1, num2) => {
  return num1 + num2
}
function addTwoNumbers (a, b) {
  } function addTwoNumbers (a, b) {
    return num1 + num2
  }

I’ve edited your code for readability. When you enter a code block into a forum post, please precede it with a separate line of three backticks and follow it with a separate line of three backticks to make it easier to read.

You can also use the “preformatted text” tool in the editor (</>) to add backticks around text.

See this post to find the backtick on your keyboard.
Note: Backticks (`) are not single quotes (').

const addTwoNumbers = (num1, num2) => {
  return num1 + num2;
}
{
  function addTwoNumbers (a, b) {
    return num1 + num2;
  }

Is that your code or where you having issues sharing your code?

If that is your code, you are creating addTwoNumbers too many times. It needs to be only once

Revise my updated code.

you still have addTwoNumbers more than once

Like this? function addTwoNumbers (a, b)
return num1 + num2;
{Preformatted text

I’m lost show me an example of the final solution.

*still with me on this one?

const addTwoNumbers = (num1, num2) => {
return num1 + num2;
}

The above was the starting code for the challenge.

Below is one of your attempted code.

You have changed the parameters name. The test is specific about the challenge instructions. So, don’t change anything that not asked in the challenge instructions.

I tried to make things difficult through overthinking everything, I eventually passed lol! Thanks!

1 Like