Dlaczego działa String (null)?

null iundefined nie mamtoString lubvalueOf metoda. Afaik używaString dzwonitoString metoda jego parametru (np.String({}) =>[object Object]).

DlaczegoString(null) lubString(undefined pracujesz? Nie robi tego domyślnieObject.prototype.toString.call(null). ponieważ to ocenia[object Null].

[edit]: ze specyfikacji ECMA-262 / 5th edition (strona 48). To nie dodaje do wyjaśnień, powiedziałbym:

<code>/*
Table 13 — ToString Conversions  
-------------------------------------------------------------------------
Argument Type  | Result  
-------------------------------------------------------------------------
Undefined      | "undefined"
Null           | "null"  
Boolean        | If the argument is true, then the result is "true".
...            | ...
*/
</code>

questionAnswers(4)

yourAnswerToTheQuestion