What does if (t == +t) { ... }
mean?
Sorry for asking such a simple question, but I have searched for "plus operator" and tried to evaluate it in javascript myself, but I cannot guess what the purpose is.
What does if (t == +t) { ... }
mean?
Sorry for asking such a simple question, but I have searched for "plus operator" and tried to evaluate it in javascript myself, but I cannot guess what the purpose is.
Its a unary operator and it coerces t
to a number from a string. It has the same effect as:
if (t == Number(t)) { ... }
For more information: Is plus sign in +process a typo in Node.js documentation on domains?