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