Rhino is a Mozilla open-source javascript interpreter written by Java.
Document address https://developer.mozilla.org/en/Rhino_documentation
Installation Method http://www.terminally-incoherent.com/blog/2008/01/08/rhino-scripting-java-with-javascript
Install.
Sudo apt-Get install rhino in Ubuntu
Then write a. js file with the following content:
Print ("Hello World ")
Enter rhino A. js in the terminal. The input Hello world is displayed.
In rhino, the variable object in the JS execution environment can be returned. Pass _ parent __
Function f () {var Bob = 'hello'; var inner = function () {}; var parent = inner. _ parent __; var contents = ''; For (K in parent) contents + = K +''; print (contents);} f ();
Output: arguments Bob inner parent Contents
Take a lookCodeWhat will be output?
Function A () {var a2 = "in"; return function () {var B = 2; return B;} var B = a (); var contents = ''; for (K in B. _ parent _) contents + = K + ''; print (contents)
Output: arguments A2
What are described above? The scope chain of function B has been created when the function is defined.