When it comes to computers, the only thing that matters or even exists is data. You can read, create and even modify data but all the operations that happen can happen only on data.
All this data is stored in terms of binary values called Bits, usually represented by 0’s and 1’s, the language of computers.
Therefore all the data that you enter into your machine, is first converted into this binary data and then interpreted by the system.
Now, whenever you come across a screen like this in a movie, all these 0’s and 1’s are what basically amounts to a lot and a lot of data.
Though programmers don’t really code in binary, and this is just a way to make it look exciting, in fact, coding doesn’t really look that exciting but you can still make pretty decent things.
So now that we know how data looks like, imagine going through that screen and trying to figure out what the hell is going on?
Each Value has a type that determines the kind of data it represents, it may represent a number, it may represent text, and so on.
There is also Symbol and BigInt but we will not be talking about them here, so let’s start.
It’s just called number.
It can store, positive numbers, negative numbers, whole numbers, integers, decimal numbers often called floats.
I’ll be using the google chrome developer tools to showcase some of the code and if you are new to chrome or haven’t really heard about developer tools before.
Chrome DevTools is a set of web developer tools built directly into the Google Chrome browser. DevTools can help you edit pages on-the-fly and diagnose problems quickly, which ultimately helps you build better websites, faster.
What we can do with numbers, are some basic arithmetic operations, it is basically like a calculator, that’s definitely a bit more exciting than just getting the numbers back, we have finally done something with the numbers that we had.
I know, it still confuses the hell out of me as well.
We can get NaN if we do an arithmetic operation with NaN itself, the result would be NaN or if we divide zero by zero.
Before we end the topic of numbers let me introduce you to some more values which are Infinity, Negative Infinity, Zero, and, Negative Zero.
A string is basically a textual piece of data, that’s it.
If you want to write any piece of text, it is identified as a string. The only rule is that it needs to be surrounded by quotes.
We have three types of quotes:
- Double Quotes: “Hello”
- Single Quotes: ‘My Name is’
- Backticks: `Vibhor`(Not to be confused with single quotes, backticks are generally the ones above the tab key on a standard keyboard)
Now if you are used to some other languages like C, you will note that there is no special character type, for instance, char in C.
In simple terms, it is used to identify whether something is true or false and thus Boolean has only two values.
It is used to store yes/no values, true if the evaluated expression is correct or false if the evaluated expression is incorrect.
Now if you are confused why ‘a’<’C’ gave the answer as false, simply because the system is not recognizing them as letters but as values, and when converted into values the value of ‘a’ is
97 and the value of ‘C’ is 67. These are called ASCII values, you can read more here.
Unlike in other languages, it doesn’t refer to a null pointer or a non-existing object, it is a special type of its own which holds only null value.
In the above example, it only states that name is empty, thus null.
If you have no idea what ‘let’ or ‘name’ means, name is a variable that holds the value of null. I will cover variables in detail in the next section of this guide.
Undefined is a bit different from null, where null states that the value is empty, undefined means that the “value is not assigned”
It has yet to be given a value.
Find the Guide Map