Ad
  • Custom User Avatar

    The word will be different each time due to testcases and will also include random words (randomisation) to prevent cheating. The word will be named s which is the parameter of the function.

    As shown in the image above, you can print the input s to the console to see what it is if you want, but your code should work on every single word, not just one specific one. Therefore it is not necessary to see what the parameter s is. console.log(s) is responsible for the log result in the left and return s is responsible for returning the final value shown by "Expected: 'es', instead got: 'test'".

    The example testcases show you what the parameter s is, and what the expected result is.

    Test.assertEquals(getMiddle("test"),"es")
                                  ^       ^
                                  |       |
                              the word  the result
    
  • Custom User Avatar

    To further what Voile has said, s is the variable that stores the word that you are sent. So if you get sent the word Hello, s would be equal to Hello. So if I decided to go:

    document.write(s)
    

    The output would be:

    Hello
    

    As Voile has said, you may want to take a look at variables and functions in general to get a better understanding of writing code.

  • Custom User Avatar

    s is the input argument storing the word.

    I suggest you to take a look what are variables, function arguments and function parameters :)

  • Custom User Avatar

    It is sent to the method/function that you write. In javascript the function looks like this:

    function getMiddle(s)
    {
      //Code goes here!
    }
    

    s is the word you are being given. If you have any other questions, let me know.