1/38
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced |
---|
No study sessions yet.
JavaScript
A programming language that plays a crucial role in web development. It focuses on the behavior of the website.
Vanilla JavaScript
Also known as plain JavaScript, refers to the original, unmodified JavaScript language without any additional frameworks or libraries. It represents the pure version of JavaScript that runs directly in web browsers, relying solely on the language’s built-in methods and objects.
Arrow Functions
Provides a concise syntax for writing function expressions, introduced by ES6.
Template Literals
This allows you to embed expressions inside strings using backticks (`).
Destructing
This allows you to extract values from objects or arrays easily.
<script> tag
It is used to embed or reference JavaScript code within an HTML document.
<script> in the <head> section
When placed here, the script is loaded before the page content, which ensures that it’s available for use throughout the page.
<script> in the <body> section
When placed here, the script is loaded after the page content, which can improve page load performance.
External JavaScript Syntax
<script src = “filename.js”> </script>
document.getElementById()
allows you to select an HTML element based on its unique ID
Fundamental Part of HTML DOM
document.getElementById()
Variables
It is a named container that holds a value. It allows you to store and manipulate data throughout your application.
Use of const variable
Used if the value should not change (especially for arrays and objects).
Use of let variable
Used if you need a mutable variable.
Use of var variable
Used only for older browsers that don’t support let and const.
let
This is used to declare block-scoped variables. This means they are accessible only within that block in which they are defined.
const
This also has a block scope, it is used to declare immutable variables. Only you assign a value to this variable, you cannot change it later.
var
It is used to declare variables.
Scope of var
Its scope are function or global
Scope of let and const
Block scope
Identifier
This starts with a valid character. It is recommended to avoid starting with a number, it is case sensitive, and special characters are not allowed with the exception of underscore and dollar sign.
Undefined Data Type
Denotes a variable that has been declared but not initialized.
Null
Represents an intentional absence of any value.
Symbols
Represents unique and immutable values.
Operators
Have 6 types that allows you to perform different tasks in JavaScript.
Arithmetic Operators
These operators perform mathematical operations on numbers.
Assignment Operators
These operators are used to assign values to variables.
Comparison Operators
These operators compare values and return a boolean result.
String Operators
The operators is used for concatenation or to join strings together.
Logical Operators
These operators are used for logical operations
Ternary Operators
These operators allow you to write concise conditional statements. It takes three operands: a condition, a result for true, and a result for false.
prompt()
This method shows a pop-up dialog box containing a message, an input field for the user to type their input, and two buttons: ‘OK’ and ‘Cancel’.
if statement
This statement allows you to execute a block of code if a specified condition evaluates to true.
if and else statement
These statements allows you to execute different blocks of code based on a condition.
if and else if statement
These statements allow you to test multiple conditions sequentially and execute the corresponding block of code for the first true condition.
switch statement
This statement provides an efficient way to handle multiple cases based on the value of an expression. It evaluates and compares it against various cases. If a match is found, the corresponding block of code is executed.
for loop
This loop allows you to execute a block of code repeatedly for a specified number of iterations.
while loop
This loop executes a block of code as long as a specified condition remains true.
do-while loop
This loop executes the code block at least once, and then continues as long as the specified condition is true.