freeCodeCamp Challenge Guide: Assignment with a Returned Value

freeCodeCamp Challenge Guide: Assignment with a Returned Value
0

#1

If you’ll recall from our discussion of Storing Values with the Equal Operator, everything to the right of the equal sign is resolved before the value is assigned. This means we can take the return value of a function and assign it to a variable.

Assume we have pre-defined a function sum which adds two numbers together, then:

var ourSum = sum(5, 12);

will call sum function, which returns a value of 17 and assigns it to ourSum variable.


#2

Solution is very simple of this question:
// Example
var changed = 0;

function change(num) {
return (num + 5) / 3;
}

changed = change(10);

// Setup
var processed = 0;

function processArg(num) {
return (num + 3) / 5;
}

// Only change code below this line

processed = processArg(7);


#3

You need to be smart: And follow this formula in assigning a number for **processArg** function (X + 3) / 5 = 2


#4

Hey fellow campers.Everyone is unique when it comes to learning.Use whichever method you find fit to drive the logic home.This is how I did it:

// Example
function minusSeven(num) {
return num - 7;
}

// Only change code below this line

function timesFive(num) {
return num * 5;
}

var answer = timesFive(5);


#5

Sorry that was for previous challenge.


#6

Here we go:

// Example
var changed = 0;

function change(num) {
return (num + 5) / 3;
}

changed = change(10);

// Setup
var processed = 0;

function processArg(num) {
return (num + 3) / 5;
}

// Only change code below this line

processed = processArg(7);