Basic JavaScript - Return a Value from a Function with Return

The code is like this:

//Setup
let sum = 0;

function addThree()  {
  sum = sum + 3
}
function addFive() {
  sum = sum + 5
}

//Only change the code below this line

//Only change the code above this line

addThree();
addFive();

Please don’t delete information from the auto generated posts about the challenge.

Is this the link
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/return-a-value-from-a-function-with-return

Can you explain in words what you are confused about?

By the way, the link is like this:

  • addSum is a function without a return statement. The function will change the global sum variable but the returned value of the function is undefined .

Yes :+1: :+1: :+1: :+1: :+1:

Do you have a question about this challenge?

It is great that you solved the challenge, but instead of posting your full working solution, it is best to stay focused on answering the original poster’s question(s) and help guide them with hints and suggestions to solve their own issues with the challenge.

We are trying to cut back on the number of spoiler solutions found on the forum and instead focus on helping other campers with their questions and definitely not posting full working solutions.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.