Tell us what’s happening:
The last few exercise about equality operators are checking 7 and 99 an so on but there is a 10, what’s it got to do with the code or question. It’s very distracting.
Your code so far
// Setup
function testStrictNotEqual(val) {
if (val) { // Change this line
return "Not Equal";
}
return "Equal";
}
testStrictNotEqual(10);
Your browser information:
User Agent is: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/83.0.4103.116 Safari/537.36.
Challenge: Comparison with the Strict Inequality Operator
This is the function being called. the testStrictNotEqual function will not do anything unless it is called. The 10 is the argument that is passed in as val in this instance.
So could it be any number. If so, why don’t they explain that it, the 10 has noting to do with the exercise, it could be 3287. I know you know what you are doing it but we(students) don’t and we are a looking at every detail and asking what is that there for but you don’t explain you just move us on to the next bit of gobbledygook.
Thanks you now I understand that we can ignore big hunks of code in our work area; it’s just part of the set up for our little task in the exercise.
A little comment like //this 10 could be any number, its just calling the function. would be very helpful, at least for the first few times it’s used.
What number it is does matter, because the function will return different values depending on what arguments it receives. That’s how you test your code.
The exercise is to write a function that takes a single value. To check it works, you use the function, you give it a value. You can give it different numbers (or anything, doesn’t have to be a number). It has a 10 there, you can change that to a 17, or “hello”, or true or whatever you want to check to make sure your function does what it’s being asked to do.
The tests that run when you press submit check the function works as described – if the code is correct, it will give you a tick because it returns the correct thing each time. They do the same thing: run the function with some arbitrary value and see if the function returns the correct result for that value.
The function call is there for you to put values for you to check that it works. How else are you checking that the code does what you expect it to do?
Yes thank you, that what I was trying to say. Learners see things differently to people who are proficient. We don’t know what to ignore and where to focus, so we ask to check and then get told oh yes that matters when, it might have some meaning but it does not matter for that exercise.
But what I’m saying is that it does matter. This is kinda what I was trying to get at when you were trying to describe the problems you were having with the stand in line challenge: I think you’re missing the point of writing functions a little bit. When you’re writing some code, you need to check it’s working, so the way you do that here is you just call the function, you can see if anything breaks. If you don’t have that, you can’t tell until you try to submit and the tests run