This is the first part of the twenty-one part series of blogs.I will be blogging my learnings from each chapter of the book EloquentJS."Below the surface of the machine, the program moves. Without effort, it expands and contracts. In great harmony, electrons scatter and regroup. The forms on the monitor are but ripples on the water. The essence stays invisibly below."...The book starts off with this quote. I personally think it kind of adds the importance of the work of a coder or a developer.
Bits are any kind of two-valued things, usually described as zeros and ones. So they could be expressed as typically any opposites. Black and White, strong and weak electrical signal anything.
Imagine a sea of bits—an ocean of them. A typical modern computer has more than 30 billion bits in its volatile data storage and Nonvolatile storage (the hard disk or equivalent) tends to have yet a few orders of magnitude more. To be able to work with sooooo many bits we need better representation using chunks called 'values'.
How to depict Fractional Numbers? Use a dot (like 8.34).
Big or small numbers use e(exponent)...like 7.994e4.
Calculation with Whole numbers is always precise. And with fractional numbers not quite hence use approximations.
Consider 13 + 11 * 9
The + and * symbols are called operators. Basically two values get along perform an operation and give out a new value( I mean that almost sounds like a relationship).
They are applied left to right. When in doubt, just add parentheses(sure. haha).
NEW OPERATOR IN TOWN!! The % symbol is used to represent the remainder operation. The remainder operator’s precedence is the same as that of multiplication and division. You’ll also often see this operator referred to as modulo.
The special entries here are Infinity, -Infinity, and NaN(Not a Number). These numbers are used to perform mathematical sins like infinity - 1, 0/0, Infinity - Infinity.
A string is declared itself if it is enclosed within quotes. You can use single quotes, double quotes, or backticks to mark strings, as long as the quotes at the start and the end of the string match.
When does it get difficult? imagine how putting quotes between quotes might be hard
ROLE OF \n.... I am doing the neogcamp \n I aspire to be a Web Dev.
It Will is written as: I am doing the neogcamp.
I aspire to be a Web Dev.
BTW, you cannot perform operations on strings. you can concatenate it but not add
Not all operators are symbols.
typeof operator, which produces a string value naming the type of the value you give it.
Operators that use two values are called binary operators, while those that take one are called unary operators.
FUN FACT: The minus operator can be used both as a binary operator and as a unary operator.
Compare two values using Comparison Operators.
Strings can be compared too!.
console.log("Aardvark" < "Zoroaster")
// → true
uppercase letters are always “less” than lowercase ones, so "Z" < "a".Goes from left to right, comparing the Unicode codes one by one.
&& AND operator results truly only if both values to it are true.
|| OR operator results true only if either value to it is true.
Operates on three values. When it is true, it chooses the middle value, and when it is false, it chooses the value on the right.
console.log(true ? 1 : 2);
// → 1
console.log(false ? 1 : 2);
// → 2
There are of these null and undefined, used to indicate absence of a meaningful value.
Automatic Type Conversion:
console.log("five" * 2)
// → NaN
console.log(false == 0)
// → true