62 lines
1.6 KiB
Plaintext
62 lines
1.6 KiB
Plaintext
1.0 Direct Testing, no starting at Parameter
|
|
* The indexOf String "Hello" is 0
|
|
* The indexOf String "Hi" is 1
|
|
* The indexOf Boolean 'true' is 2
|
|
* The indexOf Number '5' is 3
|
|
* The indexOf Number '9' is 5
|
|
|
|
2.0 A firstIndex parameter of 1 (positive offset test)
|
|
* The indexOf String "Hi" is 1
|
|
* The indexOf Boolean 'true' is 2
|
|
* The indexOf Number 5 is 3
|
|
* The indexOf Number 9 is 5
|
|
|
|
3.0 A firstIndex parameter of -4 (negative offset test)
|
|
* The indexOf String "Hi" is -1
|
|
* The indexOf Boolean 'true' is -1
|
|
* The indexOf Number 5 is 4
|
|
* The indexOf Number 9 is 5
|
|
|
|
4.0 A big positive firstIndex of 1000, to test the firstIndex > length
|
|
* The indexOf Number '9' is -1
|
|
|
|
5.0 A big positive firstIndex of 4294967301, to test when firstIndex > width of int (32-bits)
|
|
* The indexOf Boolean 'true' is -1
|
|
|
|
6.0 No arguments
|
|
* No arguments passed: 7
|
|
* No arguments passed: -1
|
|
|
|
7.0 Looking for null
|
|
* The indexOf null is 6
|
|
* The indexOf null is -1
|
|
|
|
8.0 Extra arguments
|
|
* The indexOf String "Hello" is 0
|
|
|
|
9.0 NaN firstIndex
|
|
* The indexOf String "Hi" is 0
|
|
|
|
10.0 Small firstIndex
|
|
* The indexOf Boolean 'true' is 2
|
|
|
|
11.0 Negative firstIndex bigger than the length of the array
|
|
* The indexOf Boolean 'true' is 2
|
|
|
|
12.0 Negative firstIndex bigger than 32-bits
|
|
* The indexOf Boolean 'true' is 2
|
|
|
|
13.0 Looking for undefined
|
|
* The indexOf undefined is 7
|
|
* The indexOf undefined is -1
|
|
* The indexOf undefined is 3
|
|
* The indexOf undefined is -1
|
|
* The indexOf undefined is -1
|
|
|
|
14.0 Object using the Array prototype
|
|
* The indexOf String "Hello" is 0
|
|
* The indexOf String "Hi" is 1
|
|
* The indexOf Boolean 'true' is 2
|
|
* The indexOf Number '5' is 3
|
|
* The indexOf Number '9' is 5
|