blob: af50c50256e70434fff102c913760c83aae39251 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
|
function simple(str) {
assertEq(str.toString(), "abc");
assertEq(str.valueOf(), "abc");
}
function obj(str) {
var obj = new String(str);
assertEq(obj.toString(), "xyz");
assertEq(obj.valueOf(), "xyz");
}
function mixed() {
for (var v of ["abc", new String("abc")]) {
assertEq(v.toString(), "abc");
assertEq(v.valueOf(), "abc");
}
}
for (var i = 0; i < 100; i++) {
simple("abc");
obj("xyz");
mixed();
}
|