JavaScript/Relation to other languages

From Wikibooks, open books for an open world
Jump to: navigation, search
Previous: Placing the Code Index Next: Lexical Structure

If you have programming experience or training with another language, learning JavaScript will be easier and more difficult at the same time. The easy part will be picking up the syntax, especially if you're used to a language like Java or C++, much of the arithmetic and control logic is the same.

C-like languages, (C++ and Java)[edit]

Be careful, JavaScript is deceptive, it might entice you with its C-like syntax but underneath is an entirely different beast.

Dynamic Variables[edit]

Starting with the obvious JavaScript is a loosely typed language. There are several implications to this:

  • Integers and floats are both represented by 64 bit floating point numbers. (But crazily enough bitwise operations are still available, and sometimes faster)
  • You may change a variable's type at will
  • Variables can be added and removed from an object at will.

The list goes on, and we are granted amazing powers to do wonderful and sometimes incredibly stupid things whilst programming, so it's very important to keep sober-minded when attempting to harness the power of the dynamic variables.


JavaScript is a classless language; classes can be simulated, but if you remove the idea of classes from your head and the learning process will become easier.

Variable Scope[edit]

There are no such things as public, private or protected variables, again, these can be simulate, but again it's best if you don't envisage such concepts, they will only hinder you. Go to {JavaScript/Closures} for more information on scope.

Previous: Placing the Code Index Next: Lexical Structure