I
I
Ivanushka2552021-06-09 12:17:07
JavaScript
Ivanushka255, 2021-06-09 12:17:07

Can a method exist before it is written?

Reading learn.js :
1. Source

The obj[Symbol.toPrimitive](hint) method is called first, if it exists.

2. Source
Most built-in objects don't have such a valueOf , so numeric and string conversions work the same for them. The exception is the Date object, which supports both types of conversions.


That is, if I correctly understood the text of the textbook, then:
1. The method obj[Symbol.toPrimitive](hint)is executed "under the hood", some objects have this method, some do not. So?
2. valueOfMost objects do not have a method. And some people have it as St.? That is, I mean, it can be seen in the debugger among the properties?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question