SUMMARY OF JAVASCRIPT PROGRAMMING COMBINE
SUMMARY OF JAVASCRIPT PROGRAMMING COMBINE
Eloquent Java
script (summary)
Values, Types and operators
All data in the computer is stored as long sequences of bits and thus its
fundamental.
Bits
Bits are any two valued things usually described as ones and zeros they take
forms in the computers such as high or low electrical charge strong or weak signals.
Values
Modern computer have large amount of bits in order to work with them, we
must separate them to chunks that represents parts of information. And in
JavaScript those chunks are called values hold different thing e.g.;
Numbers
Plain text
Functions
Numbers
JavaScript uses a fixed number of bits, 64 of then to store a single number
value.
The number of different numbers that can be stored are limited.
Arithmetic
Arithmetic operations in java script include addition(+), subtraction(-),
multiplication(*) and division(/) this operators take two number values and produce
a new number.
When operators appear together with a parenthesis the sequence they are
applied is determined by the progression of the operators
There is one more operator (%) it is used to represent the remainder it is
referred to as modulo.
Special Numbers
Special numbers in JavaScript include;
Infinity: this represents mathematical infinity it occurs when a number
exceed the longest possible value.
There are other special numbers in JavaScript like positive and negative zero,
biglint. But this are the main three.
Strings
String is a data type in JavaScript they are used to represent text they are
written by enclosing their content in quotes e.g., Single quotes, Double quotes and
backlits (Usually called template literals) to mark string.
Newline
The character when you pressed enter can be included only when the string
is quoted with a back-slash (\). backtics can also be used to embed other values.
.
Strings to have modeled as a series of bits to be able to exist inside the
computer. JavaScript does this using Unicode standard. Basically, every character in
a string can be represented as a sequence of numbers.
Arithmetic operators can not be used with string except for the (+) operator
which is used to combine strings together this called concatenation.
Unary Operators
Operators that use two values are called binary operators while those that
take one are called unary operators. There is also ternary operators which operate
on three values.
Boolean values
This values include TRUE and FALSE they also used for comparison
Binary operators
(<) is less than
(>) is greater than
(>=) greater than or equals to
(<=) less than or equals to
Logical operators
This are operator that can be applied to Boolean values. logical operators in
JavaScript include; “and”, “or” and “not”.
The “&&” operator represent the logic and its result is true only if both values
given to it are true.
The “||” operator denotes logical “or” it provides true if either of the values
given its true.
The “Not ” operator is written as an exclamation mark “!” it is a unary
operator that flips the value given to it as in true==false, false==true.
Empty Values
These values include “Null” and “undefined” they are used to identify values
that don’t carry information.
Automatic type conversion
When an operator to the “wrong” type of value, JavaScript will quietly convert
the value to the type it needs, using a set of rules that aren’t what you would
expect this is called “type coercion” when you don’t want a type conversion to
happen there are two other operators you can use “===” to check if the value is
precisely equals to the other value and “!==”to check if the value is not precisely
equals to the other.