What is "==+!" in javascript? -
does can show me "==+!" meaning in below code:
if(my_var.length==+!0) //do
i try google don't result.
think of this:
if (my_var.length == (+(!0)))
since !0 === true
, +true === 1
, end sequence of evaluation:
if (my_var.length == (+(!0))) if (my_var.length == (+true)) if (my_var.length == 1)
fyi, can see ordered list of javascript operator precedence when deciding how process operators here.
of relevance here, precendence of !
operator highest, unary +
operator , ==
operator.
see results of !0
, +true
here: http://jsfiddle.net/jfriend00/wh840n3q/
Comments
Post a Comment