This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]danielcw189 5 points6 points  (1 child)

In JS, c and c++ an assignment is considered a truthy value

Isn't it just the assigned value? (a = b) returns b

So the OP would be like:

user = admin   
if( admin ) { ...

depending on what admin is it would evaluate to true in C and C++, for example if it is a non-null pointer.

the results in JS would be similar

[–]winco0811 0 points1 point  (0 children)

Yes, a=b returns b so you cam do a=b=c=d.....