A popular programming language commonly used to create interactive effects within web browsers.
A place to store values, can store any kind of information (data types): numbers, words, collections of data
A variable that has no value
To create a variable - done by using:
let variableName = value;
Set (give) some value to a variable.
A set of characters, word(s), phrase. To initialize variable with a string you need to put this string into quotes.
Boolean variable represent a logical value True or False
An ordered list of values, can store different types of data inside
Mathematical operators, such as: +, -, *, /, >, <, = etc
Comments are notes that you can leave for yourself or another person, a note that a computer will not read. You can write a comment on a new line or on the same line after code as so:
let variableName; // I’m your comment
Single line comments start with //
and continue for the entire line
Multi line comments are placed between /* .. */
and can end at any point on a line
A separable, reusable piece of code. It takes some input, does some manipulation on it and returns an output.
To create a function
A value input that functions can accept
if
is used to decide if lines of code should be executed, else
- gives an alternative set of instructions.
Example:
if (x > 5) {
console.log("X bigger than 5");
}
else {
console.log("X smaller than or equal to 5");
}
It repeats code over and over again until some condition is met.
This loop is similar to ‘while loop’, just with a set amount of repetition. You declare counter in the statement as so:
for (let i = 0; i < 5; i++) {
do something 5 times
}
This is an error which means that a loop does not stop.
In order to avoid this error each loop should have some condition so it can stop, and contain some way to trigger the condition.
A collection of properties
A type of object that is created when a user interacts with a web page. For example, JavaScript creates an event when a user clicks on a button.
Stands for Cascading Style Sheets. CSS describes how HTML elements are to be displayed on screen. It is presentation.
Stands for Hyper Text Markup Language. It is a structure of the elements on the page.
Stands for Document Object Model. It defines the logical structure of documents and the way a document is accessed and manipulated.
Scope is the set of variables, objects, and functions that you can access.
A method of interacting with the system. In order to write to the browser console, you could use console.log(‘Hello World’). This would write Hello World in the browser console.