Ajax : It stands for Asynchronous Javascript And XML. When click some button on the webpage, the webpage does not change. The web browser make request to the server on the background. This is asynchronous process.
Closure : It gives tou access to an outer function's scope from an inner function.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
</head>
<body>
<script>
var numbers=[20,10,9,8,7,6,5,4,3,2,1];
var sortfunc=function(a,b){
return a-b;
}
console.log(numbers.sort(sortfunc));//sortfunc calls callback
//sort mathod which receive callback function(sortfunc) receiving the content of sortfunc as a parameter, and then calling internally, change the sort function
function outter(){ //outer function
var title = 'coding everybody'; //local variable defined in the outer function
function inner (){ //inner function
alert(title); //if there is no title variable in inner function, it starts to search same variable in outer function
//in other words, inner function can access local variable in outer function
}
inner();
}
outter();
</script>
</body>
</html>
'JavaScript' 카테고리의 다른 글
object, encapsulation, information hiding, interface (0) | 2021.01.11 |
---|---|
arguments, function (0) | 2021.01.11 |
global variable, anonymous function (0) | 2021.01.07 |
global variable, local variable (0) | 2021.01.07 |
.push(), .concat(), .unshift(), .splice, .shift(), .pop(), .reverse() (0) | 2021.01.07 |