javascriptbeginner5 minutes

Sum Two Values

Write a function that returns the sum of two numbers.

Challenge prompt

Create a function called addNumbers that takes two parameters and returns their sum.

Guidance

  • Create a function with two parameters.
  • Use the return keyword.
  • Test the function with simple numeric values.

Hints

  • The function should accept two inputs.
  • You want to return a + b.

Starter code

function addNumbers(a, b) {
  // your code here
}

Expected output

addNumbers(2, 3) should return 5.

Core concepts

functionsparametersreturn values

Challenge a Friend

Send this duel to someone else and see if they can solve it.