You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This only happens when at least one of the arguments is a string. Otherwise, values are converted to numbers.
This is confusing as it implies that as long as an expression contains a string, the whole expression will be a string. However based on the example 4 + 5 + "px" which gives 9px, this is not the case. I understand the "arguments" to be for +, but it can also be read as arguments for the alert() function. I think being a little more explicit is better here. Maybe state something like only the immediate left and right operands of the + operator is affected? And the expression is evaluated from left to right (or by operator precedence)?
The text was updated successfully, but these errors were encountered:
Just saw https://javascript.info/operators after type-conversions, perhaps operators should come first? After all we need operators to use some of the type conversions.
https://javascript.info/type-conversions
This is confusing as it implies that as long as an expression contains a string, the whole expression will be a string. However based on the example
4 + 5 + "px"
which gives9px
, this is not the case. I understand the "arguments" to be for+
, but it can also be read as arguments for thealert()
function. I think being a little more explicit is better here. Maybe state something like only the immediate left and right operands of the + operator is affected? And the expression is evaluated from left to right (or by operator precedence)?The text was updated successfully, but these errors were encountered: