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.
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."
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.
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.
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 parameters
is.console.log(s)
is responsible for the log result in the left andreturn 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.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."
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.
To further what Voile has said,
s
is the variable that stores the word that you are sent. So if you get sent the wordHello
,s
would be equal toHello
. So if I decided to go:The output would be:
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.
s
is the input argument storing the word.I suggest you to take a look what are
variables
,function arguments
andfunction parameters
:)my word is, the letter s? I'm supposed to find the middle character in the letter s?
It is sent to the method/function that you write. In javascript the function looks like this:
s
is the word you are being given. If you have any other questions, let me know.So um...it says I'm going to be given a word...so....where's the word?