You are viewing a plain text version of this content. The canonical link for it is here.
Posted to docs@cocoon.apache.org by st...@outerthought.org on 2003/08/27 10:00:03 UTC

[WIKI-UPDATE] JavascriptForJavaProgrammers Wed Aug 27 10:00:03 2003

Page: http://wiki.cocoondev.org/Wiki.jsp?page=JavascriptForJavaProgrammers , version: 9 on Wed Aug 27 07:40:10 2003 by AntonioGallardo

- In order to reduce the barrier to entry of the Cocoon flow layer for Java programmers that haven't done much with JavaScript I thought I'd give an overview of some of the similarities and differences between JavaScript (specifically Rhino - [http://www.mozilla.org/rhino]) and Java.
?                                                                                                                                                                                                                                               ^^^^

+ In order to reduce the barrier to entry of the Cocoon flow layer for Java programmers that haven't done much with JavaScript I thought I'd give an overview of some of the similarities and differences between JavaScript (specifically [Rhino|http://www.mozilla.org/rhino]) and Java.
?                                                                                                                                                                                                                                          +     ^

- I also encourage you to play around with the Cocoon Flow debugger ([http://xml.apache.org/cocoon/howto/howto-flow-debugger.html]), as it contains an interactive environment where you can type in JavaScript code and see the results.
?                                                                  ^^^                                                            -

+ I also encourage you to play around with the [Cocoon Flow debugger|http://xml.apache.org/cocoon/howto/howto-flow-debugger.html], as it contains an interactive environment where you can type in JavaScript code and see the results.
?                                              +                    ^

- These objects and functions are comprehensively documented in many places on the web so I won't describe them further here (e.g. [http://www.devguru.com/Technologies/ecmascript/quickref/javascript_intro.html]).
+ These objects and functions are comprehensively documented in many places on the web so I won't describe them further here. Please see [Quick Reference|http://www.devguru.com/Technologies/ecmascript/quickref/javascript_intro.html] or [Netscape Core JavaScript Reference 1.5|http://devedge.netscape.com/library/manuals/2000/javascript/1.5/reference/contents.html].
+ !!Type of Variables
- JavaScript has two types of variables: global variables and local variables. Local variables are only visible in the function in which they are declared. However, they are also visible to other functions defined in the same scope. Inside a function definition local variables are identified by the "var" keyword:
?                                                                                                                                                                                                                                                                                                           ^   ^

+ JavaScript has two types of variables: global variables and local variables. Local variables are only visible in the function in which they are declared. However, they are also visible to other functions defined in the same scope. Inside a function definition local variables are identified by the __var__ keyword:
?                                                                                                                                                                                                                                                                                                           ^^   ^^

- You should *always* use the var keyword to declare variables.
+ You should *always* use the __var__ keyword to declare variables.
?                             ++   ++

+ !!Statements
- JavaScript statement syntax and control structures are pretty much the same as Java: if, for, switch, while, do,  etc.
?                                                                                                                  -

+ JavaScript statement syntax and control structures are pretty much the same as Java: if, for, switch, while, do, etc.
+ !!Using Java Objects
+ 
+ !!Continuations