Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Benjamin Hedgepeth
5,672 PointsNeed help with my callback
When I invoke the the double function, I'm trying to double the value of sum
in the callback of value
? I'm getting NaN
as a result:
function value(param1, param2) {
let sum = param1 + param2;
return sum;
}
function double(callback, param1, param2) {
console.log(2 * callback);
}
double(value, 5, 6);
1 Answer

Benjamin Hedgepeth
5,672 PointsDisregard my need for assistance. I solved my own problem!
function something(param1, param2) {
let sum = param1 + param2;
return sum;
}
function factor(callback, multiple, num1, num2) {
console.log(multiple * callback(num1, num2));
}
factor(something, 6, 5, 5); // returns 60