代码片段:像数字/字符串一样用Object
let a = {};
a.toString = ()=>'abc';
a + '_test'; // 'abc_test';
let b = {};
b.toString = ()=>'123';
b+0; // '1230'
b-0; // 123
b+''; '123'
(正文完)
代码片段:像数字/字符串一样用Object
let a = {};
a.toString = ()=>'abc';
a + '_test'; // 'abc_test';
let b = {};
b.toString = ()=>'123';
b+0; // '1230'
b-0; // 123
b+''; '123'