Created by Tomasz Primke / tprimke (at) gmail (dot) com
The last update: 1st March 2015
Simple, isn't it?
It won't evaluate expression, when it's not needed.
Simple, isn't it?
Please check also the
Works in latest Chrome and FireFox.
Don't use it in your code (yet), if you don't use transpilers.
If you don't know, what transpilers are, don't use any ES 6 features.
What the heck is it???
undefined means, that something is, well, undefined.
In another words, it means, that something doesn't exist.
When you should use undefined?
When you'd like to check, whether something is defined (available), or not.
Not sure, what does it mean? Don't worry, it will be shown in the guide on functions.
It is used to mark, that no value is available.
But the adress may be unknown.
So, you could assign
null as the address.
In such situations, it's better to use
You should use arrays, whenever you have a collection of something.
Please note, that the
join method returns a string, not an array.
(As for functions, a separate guide will be prepared.)
All the ES 5.1 methods are available in IE >= 9.
Sorry, I couldn't resist...
Anyway, it's only for ES 5.1
ES 3 - way
ES 5.1 - way
ES 6 - way
I still prefer the
Especially with the fat arrow syntax.
But more on this topic in other guides.
Object is a set of properties.
And what is a property?
A property is a pair of a key and a value.
A key is a string.
(Don't worry, I'll show you an example.)
Accessing object's properties:
Objects are used for modeling entities (like a person, or an address).
Objects are also used as maps (mappings from keys to values).
Not so nice...
Fortunatelly for me, I almost never need to iterate over object's properties.
The good news: that's all of the most important stuff.
The bad news: that's all of the most important stuff.
There's nothing more.
Don't worry, though. You can do everything you need with the datatypes you have just learned about.
Date object is used to represent a single moment in time.
Check also other methods of the
You should also remember about the special values, like
For single entities, use objects.
For collections, use arrays.
There are also special objects for handling dates and JSON.