function
Contents
first class
- first class citizen:
- passed as an argument;
- be returned as result of funtions;;
- assigned to a variable
anonymous function;
- have no name;
scope
-
what? 一块区域,在这个区域声明的变量只在这个区域(以及下级区域)可见
-
types:
- block scope: in block;
- function scope: in funciton
- gloabl scope: global
-
lexical scope/ static scope vs dymanic scop
- 编译时决定了变量可见范围
- 运行时再决定变量可见范围