| 1 |
// Copyright (c) 2012 Ecma International. All rights reserved. |
| 2 |
// This code is governed by the BSD license found in the LICENSE file. |
| 3 |
|
| 4 |
/*--- |
| 5 |
es5id: 11.8.3-2 |
| 6 |
description: > |
| 7 |
11.8.3 Less-than-or-equal Operator - Partial left to right order |
| 8 |
enforced when using Less-than-or-equal operator: valueOf <= |
| 9 |
toString |
| 10 |
---*/ |
| 11 |
|
| 12 |
var accessed = false; |
| 13 |
var obj1 = { |
| 14 |
valueOf: function () { |
| 15 |
accessed = true; |
| 16 |
return 3; |
| 17 |
} |
| 18 |
}; |
| 19 |
var obj2 = { |
| 20 |
toString: function () { |
| 21 |
if (accessed === true) { |
| 22 |
return 4; |
| 23 |
} else { |
| 24 |
return 2; |
| 25 |
} |
| 26 |
} |
| 27 |
}; |
| 28 |
|
| 29 |
assert((obj1 <= obj2), '(obj1 <= obj2) !== true'); |