The parameters of all functions in ECMAScript are passed by value. 5 Basic data types: undfined,null,boolean,number,string.
All parameters in the ECMAScript are passed as values, and arguments cannot be passed by reference. A function declaration takes precedence over a function expression being parsed by the parser, and the function expression must wait until the parser executes to the line of code it is in before it is actually interpreted. Example: Alert (sum (10,10)), function sum (num1,num2) {return num1+num2;} -------------------------------alert (sum (10,10));//Error Var sum=function (num1,num2) {return num1+num2;} The name of the function is just a variable that contains pointers. Each function contains two non-inherited methods: Apply () and call (); the Apply () method accepts two parameters: one is the scope in which the function is run, and the other is the parameter array. Where the second argument can be an instance of an array, or it can be an arguments object. The call () method works the same as the Apply () method, except that the parameters are received differently, and the arguments passed to the function must be enumerated individually for the calling () method: function CallSum1 (num1,num2) {//return Sum.apply (this,arguments);//Incoming Arguments object return Sum.call (THIS,NUM1,NUM2); The above method is really powerful place to expand the scope of functions on which to run. All objects in the Boolean expression will be converted to true;
JS Advanced Programming 2nd part of the Knowledge points 4