Monthly Archives: November 2022

THE TYPE NUMBER AND OTHER PRIMITIVE DATA IN JAVASCRIPT

NUMBERS IN JAVASCRIPT Number with the ES2019 specification is the only type associated with numbers. We do not have the float type for decimal numbers. Numbers in javascript are represented according to the IEEE 754 floating point 64-bit standard. Every number even integers are represented and stored in memory as 64-bit floating point numbers. THE SCIENTIFIC OR EXPONENTIAL NOTATION Any number can be represented with scientific notation (also called exponential): mantissa*base exponent The mantissa are the significant figures, excluding zero; the base is ten because we are in the decimal system. For example, a number we [...]

By |2024-11-11T18:20:04+00:00November 8, 2022|0 Comments

OOP AND PROTOTYPE IN JAVASCRIPT

OOP AND PROTOTYPE IN JAVASCRIPT Object-oriented programming Is a paradigm that focuses on objects instead of functions. Let's look at the image below. WHAT ARE THE OBJECTS? Objects are data structures that integrate variables and functions within them. Variables are called properties and functions are called methods. The four pillars of OOP are shown in the image opposite. ENCAPSULATION To encapsulate means to enclose in a capsule. Related data and functions are grouped together. The functions or methods work internally with the data to perform the required operations. [...]

By |2024-11-11T18:29:53+00:00November 20, 2022|0 Comments

CLASSES IN THE JAVASCRIPT LANGUAGE

DEFINE A CLASS AND ITS CONSTRUCTOR A constructor function normally receives parameters as input. The keyword this makes sure that the objects created by the constructor function have a copy of those properties, properties having as values the values passed in as input. Let us see with a code example the differences between a constructor function and a class. Creating an object from a constructor function or creating an instance from a class with the same properties gives the same results. The difference is that the properties of a class must be initialized in a special [...]

By |2024-11-11T18:35:25+00:00November 21, 2022|0 Comments

THE JAVASCRIPT ENGINE

JAVASCRIPT ENGINE All our devices have a component called a microprocessor that is the brain of the devices themselves and is responsible for executing the instructions that are in memory. THE MACHINE CODE Machine language or machine code is a long series of 0s and 1s, electrical signals that the processor processes to give us output. Over the years, languages have developed that are gradually more and more distant from machine code but understandable to us humans. These languages to be executed by the processor must go through the reverse process, that is, the transformation from [...]

By |2024-11-11T18:38:58+00:00November 29, 2022|0 Comments

AJAX REQUESTS

PREREQUISITES For those like me who use Visual Studio Code as an editor, a local web server must be installed to run the code examples shown. I used the Live Server extension. Once installed to perform an AJAX request right-click on the HTML page and load the page with the server installed. One example performs an AJAX request of type POST. The data is sent to a PHP script. If you have taken my course on PHP you know that to run a script in Windows you need to have installed the Apache web server listening on port 80. [...]

By |2024-11-11T18:39:31+00:00November 27, 2022|0 Comments

THE PROMISE IN JAVASCRIPT

PROMISE INTRODUCTION In the previous example, we made two asynchronous requests, the first to retrieve the post with ID=1 and the second to retrieve the post's comments. We handled the asynchronous request with asynchronous callbacks, that is, invoked only when we have a response to our request. To make the second request (view comments) the first one (retrieve post ID=1) must succeed. There is a concatenation of events, for example, if the post in the request does not exist we cannot request its comments. Let's take a real-world example, we ask a friend to go and buy us a [...]

By |2024-11-11T18:40:16+00:00November 28, 2022|0 Comments
Go to Top