How to correct the parsing error in react

Hi Experts,

I am new to react and also programming, I would like to know why am I seeing the parsing error while my code is quite simple and easy. How can I resolve this and if yes why am I seeing this? because I use other editor (online)it shows me correct expected result but on my local it shows error.

thanks for your help

currentTime >= 1 && currentTime <12
You have to write out the entire comparison every single time and cannot write it like you would say it normally.
The program will check the comparisons first and then “&&” them → so it tries to check “<12” which is no valid syntax.

Seems like the implemented interpreter there is more forgiving.
But don’t get used to it.
When chaining conditions with && or || you should always have fully realized conditional statements on both sides.

1 Like

Hi @Jagaya ,

I tried your way but seems like no result, it is the same as it was, any clue? Thanks for your help and quick reply.

Really? That’s weird… Sorry I don’t know what else could cause a problem here.

Hi @Jagaya Sorry, my mistake your solution was correct I made a syntax error.

Ah ok, good to know ^^

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.