Home >Web Front-end >JS Tutorial >A brief discussion on pointers and addresses in JavaScript_javascript skills
Personal understanding: A pointer is just an index pointing to memory; and an address is the exact location in memory.
The following is a small example of pointers and addresses in functions:
function sum(num1,num2){ return num1+num2; } alert(sum(10,10)); //20 var anotherSum=sum; alert(anotherSum(10,10)); //20 sum=null; alert(anotherSum(10,10)); //20
Note: Using a function name without parentheses is to access the function pointer, not to call the function, so sum and anotherSum point to the same function, that is, sum=null; does not affect anotherSum;
The above is the entire content of this article, I hope you all like it