Basic JavaScript: Write Reusable JavaScript with FunctionsPassed

Tell us what’s happening:

Can get it to pass. I’ve even copied and pasted the hint solution and it still wont pass…

Your code so far


// Example
function ourReusableFunction() {
console.log("Heyya, World");
}

ourReusableFunction();

// Only change code below this line
function reusableFunction() {
console.log("Hi World");
}

Your browser information:

User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/80.0.3987.116 Safari/537.36.

Challenge: Write Reusable JavaScript with Functions

Link to the challenge:
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions

What do the failing tests say? What are the different things you have tried?

So here are the failing tests -

// running tests reusableFunction should output “Hi World” to the dev console. You should call reusableFunction after you define it. // tests completed // console output Heyya, World

Cant see where I’m going wrong…

In the code you posted above, you do not call reusableFunction after you define it.

1 Like

Okay I’ve missed something previous here, not sure how to call it…

Read the instructions again. It tells you how to call/invoke a function.
https://www.freecodecamp.org/learn/javascript-algorithms-and-data-structures/basic-javascript/write-reusable-javascript-with-functions

1 Like

Lol… My bad, thanks.

passed now

Good job. Happy coding!