Write Reusable JavaScript with Functions 2

Tell us what’s happening:
Hello guys, can plise some one tell me what am i doing wrong here?

Your code so far


```js

// 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 (Macintosh; Intel Mac OS X 10_14_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.110 Safari/537.36.

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

Hey @Some1Else,

You are creating the function right.
But, you are not calling it.
Calling the function after creating it will help you pass the test.

Does that help?

This helps a lot with readability , but I continue to have issues with reusabilty . To be more specific, the difficulty is in two areas:

  1. Receiving parameters . A lot of times I will have a search screen with multiple input fields and a button that calls the javascript search function. I have to either put a bunch of code in the onclick of the button to retrieve and then martial the values from the input fields into the function call, or I have to hardcode the HTML input field names/IDs so that I can subsequently retrieve them with Javascript. The solution I’ve settled on for this is to pass the field names/IDs into the function, which it then uses to retrieve the values from the input fields. This is simple but really seems improper.
  2. Returning values . The effect of most Javascript calls tends to be one in which some visual on the screen changes directly, or as a result of another action performed in the call. Reusability is toast when I put these screen-altering effects at the end of a function. For example, after a search is completed I need to display the results on the screen.
    // Example

function ourReusableFunction() {

console.log(“Heyya, World”);

}

ourReusableFunction();

// Only change code below this line

function reusableFunction() {

console.log(“Hi World”);

}

reusableFunction();