• 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

    Quote: "You are going to be given a word. Your job is to return the middle character of the word. If the word's length is odd, return the middle character. If the word's length is even, return the middle 2 characters."

  • Custom User Avatar

    I understand what a variable is. I understand that s is the input argument storing "the word".

    My question is, WHAT IS MY WORD.

    In the instructions it says "you will be given a word".

    Well, I'm waiting. It hasn't "given me a word" yet. Am I just supposed to make up a word myself? Because that's not what the instructions said. It said I would be provided one. Maybe I'm just completely blind but I don't see the word anywhere.

  • 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

    my word is, the letter s? I'm supposed to find the middle character in the letter s?

  • 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.

  • Custom User Avatar

    So um...it says I'm going to be given a word...so....where's the word?