Side navigation
#10935 closed bug (worksforme)
Opened December 01, 2011 12:42PM UTC
Closed December 07, 2011 09:51PM UTC
Last modified December 08, 2011 07:17PM UTC
isNumeric return true on array with only one numeric value
Reported by: | mengsoon | Owned by: | |
---|---|---|---|
Priority: | low | Milestone: | None |
Component: | misc | Version: | 1.7.1 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
isNumeric return true when the test value is an array with only one numeric value.
eg:
$.isNumeric([1,2]) will return false, but
$.isNumeric([1]) will return true instead of false.
Attachments (0)
Change History (4)
Changed December 01, 2011 01:54PM UTC by comment:1
component: | unfiled → misc |
---|---|
priority: | undecided → low |
status: | new → open |
Changed December 07, 2011 09:41PM UTC by comment:2
Can we just update the isNumeric documentation to make it clear that what's being checked is the argument's String representation?
Changed December 07, 2011 09:51PM UTC by comment:3
resolution: | → worksforme |
---|---|
status: | open → closed |
What is there to change? That behaviour is correct. http://es5.github.com/#x15.1.2.3
Changed December 08, 2011 07:17PM UTC by comment:4
@rwaldron can't we at least just add this to the other examples, to make it clear?
$.isNumeric("[1]"); // true
Confirmed in Chrome 15 and Firefox 8.
This is because the isNumeric method is using parseFloat which is coercing the array into a number.