Closed STAH closed 10 years ago
In our case $element.val() is always String, so your statement should be:
'0' != '' + ''
// >> true
After seeing jQuery docs/Google, val() can return String, Number or Array: http://stackoverflow.com/questions/9227268/how-can-val-return-number In this case we can use double cast:
0 + '' != '' + ''
// >> true
undefined + '' != '' + ''
// >> true
null + '' != '' + ''
// >> true
Great, thanks!
I like the direction, but does that solve the problem that we set out to solve?