summaryrefslogtreecommitdiff
path: root/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-4-7.js
diff options
context:
space:
mode:
Diffstat (limited to 'test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-4-7.js')
-rw-r--r--test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-4-7.js33
1 files changed, 22 insertions, 11 deletions
diff --git a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-4-7.js b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-4-7.js
index cf238e3e2..57850a027 100644
--- a/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-4-7.js
+++ b/test/built-ins/Array/prototype/lastIndexOf/15.4.4.15-4-7.js
@@ -9,19 +9,30 @@ description: >
is object overridden with obj w/o valueOf (toString))
---*/
- foo.prototype = new Array(1, 2, 3);
- function foo() {}
- var f = new foo();
+foo.prototype = new Array(1, 2, 3);
- var o = { toString: function () { return '0';}};
- f.length = o;
+function foo() {}
+var f = new foo();
- // objects inherit the default valueOf method of the Object object;
- // that simply returns the itself. Since the default valueOf() method
- // does not return a primitive value, ES next tries to convert the object
- // to a number by calling its toString() method and converting the
- // resulting string to a number.
- var i = Array.prototype.lastIndexOf.call({length: { toString: function () { return '0';}}}, 1);
+var o = {
+ toString: function() {
+ return '0';
+ }
+};
+f.length = o;
+
+// objects inherit the default valueOf method of the Object object;
+// that simply returns the itself. Since the default valueOf() method
+// does not return a primitive value, ES next tries to convert the object
+// to a number by calling its toString() method and converting the
+// resulting string to a number.
+var i = Array.prototype.lastIndexOf.call({
+ length: {
+ toString: function() {
+ return '0';
+ }
+ }
+}, 1);
assert.sameValue(i, -1, 'i');