jeudi 2 février 2017

What does return void 0 === i && (i = 3), 0 === i ? ( ..A.. ) : ( ..B.. ) do?

I came to this code but I don't understand very well what it does..

test.update = function(i) 
{ 
return void 0 === i && (i = 3), 0 === i ? (..A..) : (..B..) 
}

(..A..) and (..B..) are just other lines of code I haven't posted.

Let's say if i would have a 0 value, what the function will return?

What does "void 0 === i && (i = 3)" do? Specially (i = 3). Does that mean that if (void 0 === i) is true and i can get 3, i will be 3? And what about the comma? I've checked this question but I still don't get it.

Sorry for so many questions but I'd like to have a complete answer so I can totally understand what is going on.

Thank you

Aucun commentaire:

Enregistrer un commentaire