vendredi 13 novembre 2020

How to combine multiple "equal to"'s in javaScript if condition?

If got a number of values which I want to compare (they all have to be the same). The function e(row,col) returns an attribute of an element in a grid.

Is it possible to write something like…

if(e(1,2)==e(2,2)==e(3,2)==e(4,2)){...}

…instead of …

if(e(1,2)==e(2,2)&&e(2,2)==e(3,2)&&e(3,2)==e(4,2)){…}

?

Aucun commentaire:

Enregistrer un commentaire