diff --git a/basics.tex b/basics.tex index 38c9cb2..e7ad0ea 100644 --- a/basics.tex +++ b/basics.tex @@ -474,6 +474,8 @@ \section{Functions}\label{s:basics-functions} which means its parameters and any variables created inside it are \gref{g:local-variable}{local} to the function. We will discuss scope in more detail in \chapref{s:callbacks}. +\figpdf{figures/basics-scope.pdf}{Variable Scope}{f:basics-scope} + \begin{aside}{Stuck in the Past} Why did JavaScript introduce another syntax rather than fixing the behavior of those defined with \texttt{function}? diff --git a/book.tex b/book.tex index a7fc32a..d43fcc8 100644 --- a/book.tex +++ b/book.tex @@ -53,4 +53,4 @@ % \printindex -\end{document} +\end{document} \ No newline at end of file diff --git a/figures/basics-scope.pdf b/figures/basics-scope.pdf new file mode 100644 index 0000000..ddca07b Binary files /dev/null and b/figures/basics-scope.pdf differ diff --git a/figures/basics-scope.svg b/figures/basics-scope.svg new file mode 100644 index 0000000..579a6f5 --- /dev/null +++ b/figures/basics-scope.svg @@ -0,0 +1,3 @@ + + +
Global Scope
Global Scope
Local Variable 1
[Not supported by viewer]
Local Variable 2
[Not supported by viewer]
Function 1
[Not supported by viewer]
Function 2
[Not supported by viewer]
Global Variable
Global Variable
\ No newline at end of file