jeudi 30 mars 2017

Javascript short circuiting in if statement

I am confused about the below if statement code. Not sure what it is exactly doing

if (this.props.filterURL && nextProps.filterURL !== this.props.filterURL) {}

Can someone please help me to understand this?

Is it a short-circuiting in if statement: i.e

1- if first this.props.filterURL from left side is false then it will return false. 2- if first this.props.filterURL has a value then it will return true and the second variable nextProps.filterURL will be compared to this.props.filterURL on the right most of the statement?

Aucun commentaire:

Enregistrer un commentaire