For the most part, JavaScript looks like a C-like language in syntax. Lines end (optionally) with semicolons, conditional expressions are in parentheses (e.g. if (a == 1)
), and blocks are surrounded by braces. But there are some huge differences in both syntax and behavior. JavaScript is weakly typed, and its object oriented programming is prototype-based, much different from C++/Java. And for someone who understands how memory for C variables is allocated, JavaScript has a number of surprises in its variables and variable scoping.
- There's no block-level scoping, ...