!! (not) against Boolean () performance

I stumbled upon !! (non) operator in javascript as a way to convert a fake / true value to an inverted true / valse value, and then invert it to get the corresponding true / false. Apparently

!!("something") 

and

 Boolean("something") 

match. Are there any differences between the two? Which one is preferred?

I found some related questions ( What is the operator !! (not) in JavaScript? ), But they don't seem to affect performance. Hope this is not a duplicate.

+5
source share

Source: https://habr.com/ru/post/1203792/


All Articles