Author Archives: Help_adm

JavaScript Errors

Throw, and Try…Catch…Finally The try statement defines a code block to run (to try). The catch statement defines a code block to handle any error. The finally statement defines a code block to run regardless of the result. The throw statement defines a custom error. Errors Will Happen! When executing JavaScript code, different errors can occur. Errors can be coding errors made by… Read More »

JavaScript Regular Expressions

A regular expression is a sequence of characters that forms a search pattern. The search pattern can be used for text search and text replace operations. What Is a Regular Expression? A regular expression is a sequence of characters that forms a search pattern. When you search for data in a text, you can use this… Read More »

JavaScript Bitwise Operations

JavaScript Bitwise Operators Operator Name Description & AND Sets each bit to 1 if both bits are 1 | OR Sets each bit to 1 if one of two bits is 1 ^ XOR Sets each bit to 1 if only one of two bits is 1 ~ NOT Inverts all the bits << Zero… Read More »

JavaScript Type Conversion

Converting Strings to Numbers Converting Numbers to Strings Converting Dates to Numbers Converting Numbers to Dates Converting Booleans to Numbers Converting Numbers to Booleans JavaScript Type Conversion JavaScript variables can be converted to a new variable and another data type: By the use of a JavaScript function Automatically by JavaScript itself Converting Strings to Numbers The… Read More »

JavaScript typeof

In JavaScript there are 5 different data types that can contain values: string number boolean object function There are 6 types of objects: Object Date Array String Number Boolean And 2 data types that cannot contain values: null undefined The typeof Operator You can use the typeof operator to find the data type of a JavaScript variable.… Read More »

JavaScript Maps

A Map holds key-value pairs where the keys can be any datatype. A Map remembers the original insertion order of the keys. Essential Map Methods Method Description new Map() Creates a new Map set() Sets the value for a key in a Map get() Gets the value for a key in a Map delete() Removes… Read More »

JavaScript Sets

A JavaScript Set is a collection of unique values. Each value can only occur once in a Set. Essential Set Methods Method Description new Set() Creates a new Set add() Adds a new element to the Set delete() Removes an element from a Set has() Returns true if a value exists in the Set forEach()… Read More »

JavaScript Iterables

Iterables are iterable objects (like Arrays). Iterables can be accessed with simple and efficient code. Iterables can be iterated over with for..of loops The For Of Loop The JavaScript for..of statement loops through the elements of an iterable object. Syntax for (variable of iterable) {  // code block to be executed} Iterating Iterating is easy to understand. It simply means looping over… Read More »

JavaScript While Loop

Loops can execute a block of code as long as a specified condition is true. The While Loop The while loop loops through a block of code as long as a specified condition is true. Syntax while (condition) {  // code block to be executed} Example In the following example, the code in the loop will run, over and… Read More »

JavaScript Break and Continue

The break statement “jumps out” of a loop. The continue statement “jumps over” one iteration in the loop. The Break Statement You have already seen the break statement used in an earlier chapter of this tutorial. It was used to “jump out” of a switch() statement. The break statement can also be used to jump out of a loop: Example <!DOCTYPE html> <html> <body> <h2>JavaScript… Read More »