let obj = {
valueOf() {
return "2";
}
};
alert(obj);
I thought in the absence of toString() the valueOf() will be called when a string is expected.
let obj = {
valueOf() {
return "2";
}
};
alert(obj);
I thought in the absence of toString() the valueOf() will be called when a string is expected.
Copyright © 2021 Jogjafile Inc.
This does not call because this find
toStringin prototype chain, if we create a object without any prototype it will call