In the beginning, there were no programming languages. Things were done with the binary code which has 0 and 1 and looks exactly like this:
111 1110 0100 - This represents 2020, the year that Utopia Educators was created.
Nowadays we have programming languages that make our life a lot easier such as:
Values, Types, and Operators.
Inside the computer, there is only data which is represented by 0 and 1. You can read, create and modify data. They are a sequence of bits. For example, we can express the number 24 in bits using 0 and 1.
Since it's binary, the non-zero stand at 16 and 8 which adds up to 24.
Types of numbers:
-Fractional-uses dot. (Ex:4.5)
For big numbers, you might also find this: 1.921e8 is a scientific notation(for exponent), which is followed by the exponent.
The best way to deal with numbers is arithmetic. There are arithmetic operators such as addition(+), multiplication(*), subtraction(-), division(/), but there is also a mod operator(%). By putting the operator between the numbers, it will show a new number. Example:
The next data type is a string. With it you can represent basic text. They are usually written in quotes. Example:
"Utopia Educator is the best website"
"You should subscribe for more interesting articles"
The escaping character(/)which is followed by n, is mostly used to go to a new line for example:
It distinguishes possibilities like yes or no. They are also called true or false or 1 and o.Example:
console.log( 40 > 2)
console.log(40 < 2)
- &&(AND operator)The answer is true if the 2 of them are true.
- ||(OR operator)either of the value is true or false.
- !(NOT operator)it flips the value that is given.
Defining a function
A function definition is a regular binding where the value of the binding is a function.
Blocks and functions can be created inside other blocks and functions, producing multiple degrees of the locality.
Functions as values
The function binding usually simply acts as a specific piece of the program. Such a binding is defined once and is never changed. This makes it easier to confuse the function and its name.
In closure, you can treat functions as types, combined with the fact that local bindings are re-created every time a function is called, which brings up an interesting question.
It allows some functions to have different style.