No description provided.
Replaced `parseInt` by unary plus.
No need for bit operators to evaluate a number.
Corrected `hasOwnProperty` usage and made hash enumeration as resilie…
…nt as actual code should be.
Removed useless (and non functional) verbosity to access the `argumen…
Corrected useless `apply` and simply applied function.
Removed useless `reduce` parameter.
Made variable swapping code more realistic.
Added documentation for unary plus operator.
You need tilda operator to convert -1, which indexOf returns if text is not found to 0 and evaluate condition to false. Otherwise value will be other than zero, so condition will evaluate to true
Oh, you're right, I went too quickly here :)
However, I would argue ~ is hardly common, and != -1 is much more usual. ~ sounds more like a 140byt.es trick ;)
Corrected accidentaly removed brackets around function definition.
The point was to show how to do this with an array, like ruby does.
Oh, ok. Maybe you should use an intermediate variable then, like you did in other examples? :) It is not really clear otherwise, IMHO.
Good idea, thanks.
Corrected `indexOf` usage (to emulate `contains`).