5 Things I Didn’t Know About JavaScript Operators
TLDRA single unary operator as a prefix, +x or — x , will convert a string to an integer. A positive unary operators, + , will only transform values into integers. A negative operator, — , will both transform a value into an integer and turn it negative. Two negatives do make a positive, so probably best to just keep to the positive prefix.
5 Comments
Sort: