[javascript practice questions] function

(1) When passing a value of a primitive type to an argument, the passed value is copied to a local variable (ie, an element in the arguments object). This means that the parameters are actually local variables of the function. 
(2) When a value of reference type is passed to a parameter, the address of the value in memory will be copied to a local variable, so the change of this local variable will be reflected outside the function.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324890257&siteId=291194637