mercredi 27 janvier 2016

How is this if statement working with comma?

there is a if statement

if ((sliding || "Window" == type) &&
    nbCasement % 2 != 1 || sliding || "Garage" == type || f({
    name: "hinge"
}),
    nbCasement > 0 && !sliding && f({
    name: "side"

}),
    d && apiProperty)

with && || and ,

I thought it's same with this code:

f({
    name: "hinge"
});
f({
    name: "side"
});
if ((sliding || "Window" == type) &&
    nbCasement % 2 != 1 || sliding || "Garage" == type ||
    nbCasement > 0 && !sliding &&
    d && apiProperty)

but the result is different what I thought.

How is this statement working? which condition make f({name:xxx}) run?

Aucun commentaire:

Enregistrer un commentaire