Lodash Project #10

Hi everyone,

I’m having a bit of trouble.
Currently I am on question 10 where I am trying to test my .inRange() method, but an error pops up and says that it is not defined. (also the text keeps getting cut off and I can’t expand the are to read it more clearly) I’ve looked around but I can’t seem to find a solution.

Thanks for any help that can be provided!!

1 Like

The stray comma on line 20 is likely the cause.

you know what? I think you’re 100% right. I had a feeling it was something like that. I guess I need to take more time to step back and then return with fresh eyes so I don’t miss these small errors.

Thank you!

1 Like

Technically, since that is a statement (contains =) it would end with a semi-colon. But, since there are no more statements following, it is not needed. Best practice, though? Always include semi-colons on assignment statements.

const foo = function (bar) {

};

…no.

And you can easily verify that this isn’t the issue by putting it back and running the test again, without making any other modifications

Trace trough how it should have been defined instead, that didn’t happen at all, so obviously it’s not there when the test looks for it.

That’s a const statement, and that does end in semi-colon
The = doesn’t make it a statement, but it is part of the const statement there
A statement doesn’t have to end in semi-colon, some statements contain semi-colons, others don’t
There’s also a = operator, that isn’t a statement

Also, something that’s far easier than remembering which statements end in semi-colon is to not write out any of them (better than sprinkling them seemingly at random)