Home > Web Front-end > JS Tutorial > A brief discussion on pointers and addresses in JavaScript_javascript skills

A brief discussion on pointers and addresses in JavaScript_javascript skills

WBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWBOYWB
Release: 2016-05-16 15:48:55
Original
1159 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
Latest Issues
What are JavaScript hook functions?
From 1970-01-01 08:00:00
0
0
0
What is JavaScript garbage collection?
From 1970-01-01 08:00:00
0
0
0
c++ calls javascript
From 1970-01-01 08:00:00
0
0
0
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template