28 lines
584 B
Plaintext
28 lines
584 B
Plaintext
The ``++parseInt++`` function has two versions, one that takes a base value as a second argument, and one that does not. Unfortunately using the single-arg version can result in unexpected results on older browsers.
|
|
|
|
|
|
== Noncompliant Code Example
|
|
|
|
[source,javascript]
|
|
----
|
|
parseInt("010"); // Noncompliant; pre-2013 browsers may return 8
|
|
----
|
|
|
|
|
|
== Compliant Solution
|
|
|
|
[source,javascript]
|
|
----
|
|
parseInt("010", 10);
|
|
----
|
|
|
|
ifdef::env-github,rspecator-view[]
|
|
|
|
'''
|
|
== Implementation Specification
|
|
(visible only on this page)
|
|
|
|
include::message.adoc[]
|
|
|
|
endif::env-github,rspecator-view[]
|