The same goes for any identifier.
We define as literal a value that is written in the source code, for example, a number, a string, a boolean or also more advanced constructs,
like Object Literals or Array Literals:
An identifier is a sequence of characters that can be used to identify a variable, a function, an object. It can start with a letter, the
dollar sign $ or an underscore _ , and it can contain digits. The dollar sign is commonly used to reference DOM elements.
Another type of comment is a multi-line comment. It starts with /* and ends with */ .
In most cases, you can omit semicolons altogether from your programs.
When we need to have a reference to a value, we assign it to a variable. The variable can have a name, and the value is what's stored in a
variable, so we can later access that value through the variable name.
We have 2 main ways to declare variables. The first is to use const : const a = 0
The second way is to use let : let a = 0
const defines a constant reference to a value. This means the reference
can evaluate, and return a value.
You cannot reassign a new value to it.
Using let you can assign a new value to it.
My advice is to always use const and only use let when you know you'll need to reassign a value to that variable.
we have 2 main kinds of types: primitive types and object types.
Primitive types are numbers strings booleans symbols
And two special types: null and undefined .
Any value that's not of a primitive type (a string, a number, a boolean, null or undefined) is an object.
Object types have properties and also have methods that can act on those properties.
Arithmetic expressions are expressions that take a variable and an operator
String expressions are expressions that result into a string.
Logical expressions make use of logical operators and resolve to a boolean value
Operators allow you to get two simple expressions and combine them to form a more complex expression. We can classify operators based on the
operands they work with. Some operators work with 1 operand. Most with 2 operands. Just one operator works with 3 operands.
The + operator also serves as string concatenation.
Every complex statement with multiple operators in the same line will introduce precedence problems.
2 + - addition/subtraction
3 = assignment
After assignment and math operators, the third set is conditional operators. You can use the following operators to compare two numbers, or two
strings. Comparison operators always returns a boolean, a value that's true or false. We have 4 equality operators. They accept two values,
and return a boolean: === checks for equality !== checks for inequality
The conditional checks the expression you pass to it for true or false value. If you pass a number, that always evaluates to true unless
it's 0. If you pass a string, it always evaluates to true unless it's an empty string.
Did you notice the curly braces? That is called a block, and it is used to group a list of different statements.
You can provide a second part to the if statement: else .
Since else accepts a statement, you can nest another if/else statement inside.
A string is a sequence of characters. It can be also defined as a string literal, which is enclosed in quotes or double quotes: 'A string'
"Another string". I personally prefer single quotes all the time
block that is run until the condition evaluates to true .
Very similar to while , we have do..while loops. It's basically the same as while , except the condition is evaluated after the code block is
executed. This means the block is always executed at least once.
We use the for keyword and we pass a set of 3 instructions: the
initialization, the condition, and the increment part.
content production. It is used to make webpages interactive and provide online programs, including video games. The majority of
specification, with some engines not supporting the spectrum fully, and with many engines supporting additional features beyond
and prototype-based) programming styles. It has an API for working with text, arrays, dates, regular expressions, and basic
manipulation of the DOM, but does not include any I/O, such as networking, storage, or graphics facilities, relying for these
upon the host environment in which it is embedded.
software, including server-side in web servers and databases, and in non-web programs such as word processors and PDF software,
programming languages such as Self and Scheme.
Today IS the very first day of the rest of your life.