Re-creating lodash library - inRange()


#1

When you ask a question, don’t forget to include a link to the exercise or project you’re dealing with!

If you want to have the best chances of getting a useful answer quickly, make sure you follow our guidelines about how to ask a good question. That way you’ll be helping everyone – helping people to answer your question and helping others who are stuck to find the question and answer! :slight_smile:

Hi there, I’m stuck. I’m trying to find the right solution but I always fail the number 3 and number 4.

This is the link to my project:

Any help will be very appreciate!


#2

The problem is in your boolean expression.

Read the instructions again:

set it equal to a boolean expression that checks if start is smaller than or equal to number AND if number is smaller than end .

(emphasis mine)

Solution

const isInRange = start <= number && number < end;

Also, your last if-statement is not needed.
The boolean expression will either be true or false.
You can return isInRange immediately.

Solution

return isInRange;