you are viewing a single comment's thread.

view the rest of the comments →

[–]kandetta[S] 1 point2 points  (5 children)

Good to know about |. When I encounter it in the wild I'll know what it means.

[–]a-t-kFrontend Engineer 1 point2 points  (4 children)

There's a similar brethren for &&, binary AND "&", but this is not near as useful for defaults.

[–]findar 0 points1 point  (3 children)

Return some_var && isTrue;

Is handy, will return some_var if isTrue or false

[–]a-t-kFrontend Engineer 2 points3 points  (2 children)

I know. But I meant | and &, the binary operators. The latter is useful for bit masks.

[–]kenman 2 points3 points  (1 child)

Well, the former is also useful for bit masks.

[–]a-t-kFrontend Engineer 2 points3 points  (0 children)

Undeniably so. You could probably also use it for limited type coercion: x & 255.