As I said yesterday, JavaScript is the world’s most misunderstood language, which means that you must unlearn what you have learned. However complicated it might seem at first, it is quite easy to write and understand the most complex of JavaScript codes with just some examples.
Just a few observations before starting:
- Semicolons (;) are not mandatory, but strongly recommended!
- You can create strings using either ‘apostrophes’ or “quotes”. “You can also ‘mix them’ as you want”, but ‘always keeping the “order” when using them’.
- Always use the “var” keyword when defining variables. Otherwise, the variables will be created on the “Global Object” of JavaScript, and this is a bad thing(TM): variables created in the “Global Object” do not get garbage collected!