0

Why is the method I wrote not called ?

function fn(para){console.log(para)}
fn.toString=()=>'0'   
//fn[Symbol.toPrimitive]()=>'0'

console.log(fn)      // ƒ fn(para){console.log(para)}  I think the toString method I wrote will be called,but not
console.log(fn+'')   // 0
andrew yin
  • 31
  • 5

0 Answers0