DEV Community

Discussion on: Technique Sliding Windows algorithms

Collapse
pentacular profile image
pentacular

if (!!pivotLeft) { ... }

Just wondering if there's a special reason you're using this construct.

It looks seems entirely equivalent to

if (pivotLeft) { ... }

to me, so I'm wondering if I've overlooked something.

Collapse
difo23 profile image
Lizandro J. Ramírez Author

I don't have a special condition to use (!!) it is just custom, I like that the conditions in a certain way handle Boolean only, so when (!! Null) it allows me to be aware of its boolean value although it does not affect the final solution.