Home > Web Front-end > JS Tutorial > Analysis and summary of the difference between byval and byref_javascript skills

Analysis and summary of the difference between byval and byref_javascript skills

WBOY
Release: 2016-05-16 19:08:36
Original
1117 people have browsed it

The difference between the two:
byval passes values, and the actual parameters and formal parameters are in different memory units and do not interfere with each other!
byref passes the address. The actual parameters and formal parameters occupy the same memory unit. If the formal parameters change, the actual parameters will change! ! ! ! ! !
Popular understanding:
byval is gone forever
byref goes in and comes out again, it may be updated!
In JavaScript:
Boolean, Number, String type parameters are passed by value ==> Equivalent to ByVal in VBS;
And Object type parameters (including JS objects, Array objects, Function object, etc.), is passed by reference ==> Equivalent to ByRef in VBS

Copy code The code is as follows:




function Pass-by-value test



< ;/head>




Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template