0

I know this is a very basic question but I could not find a source to explain this code snippet. What is this code mean?

hasChanged = hasChanged || nextStateForKey !== previousStateForKey

I know the meaning of !== but How does !== work here?

Okd
  • 35
  • 4
  • `!==` works the same way - it returns a boolean. It will be `true` if `nextStateForKey` is not equal to `previousStateForKey` and `false` otherwise – VLAZ Apr 21 '20 at 07:35
  • It assigns the value of `hasChanged` *or* `nextStateForKey !== previousStateForKey` to `hasChanged`, depending on which is falsey. – deceze Apr 21 '20 at 07:35
  • [What does the construct x = x || y mean?](https://stackoverflow.com/q/2802055) + [Javascript operator !==](https://stackoverflow.com/q/1889260) – VLAZ Apr 21 '20 at 07:40

0 Answers0