FAQ: Higher-Order Functions - Functions as Parameters

I think perhaps they are wanting us to fallback to the documentation or search things we don’t fully understand ourselves. The way I understand it is google and the ability to search and find solutions to our questions is a very important tool in a coder’s arsenal. This forum is one such place to find answers as well as MDN. I have also found answers to questions on Stack andW3.
just to name a few. I have yet to have a question that hasn’t already been asked and answered at some point on some coding site. If coding is what we plan on doing we should definitely become comfortable with searching for answers, I’m sure the people that answer our questions here have questions of their own they have to search for answers to for every day.

1 Like

I can only speak for myself, but that is a very true statement.

Silly question but…

I’ve answered 3.Functions as parameters correctly (based on the assumption that the console on the right is not giving me error messages). But why is my solution not returning/displaying anything in the console? Here’s my code:-

const checkConsistentOutput = (func, val) => {
let firstCall = func(val);
let secondCall = func(val);
if (firstCall === secondCall){
return firstCall;
} else {
return ‘This function returned inconsistent results’;
}
};

checkConsistentOutput(addTwo, 3);

//end code

Many thanks!!

to show output, you need to log to the console (console.log())

Many thanks for the reply @stem94! I understand calling console.log() – I was curious why calling a function I’d written in the code pane didn’t display in the console as it has done on other lessons.

: )

the learning environment (LE) of codecademy is complex, so sometimes the exercise validations/test cases do display output. But unless you can provide exercise + code where you experienced this, its difficult to say what exactly the issue is

but don’t rely on codecademy, if you want to log something, call the log method

After passing the submission test, albeit, so there are no wrinkles. Once we’ve passed we are free to play around a bit, so take up the opportunity to explore the lesson in greater depth while you’re on that page.

1 Like

Thanks @mtf, will do!

1 Like