Home > Web Front-end > JS Tutorial > body text

A brief discussion on pointers and addresses in JavaScript_javascript skills

WBOY
Release: 2016-05-16 15:48:55
Original
1099 people have browsed it

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

Copy after login

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

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