Monthly Archives: December 2022

THE MODULES IN ES6

JAVASCRIPT MODULES IN ES6 ES6 modules are stored in files such as lib.js DEFINITION ES6 MODULE OBJECTIVES When we talk about hiding implementation details let us remember the example of the DVD player. The goals of the modules are: Abstract the code, then create an API that allows us to work abstractly Encapsulation, or enclosing the code in a capsule Having created the public API, it is possible to reuse the code inside our application and in other applications FIRST EXAMPLE AND ERROR CORS To work with the modules we need to [...]

By |2024-11-11T18:33:28+00:00December 2, 2022|0 Comments

STRICT MODE AND ERROR MANAGEMENT

STRICT MODE Javascript was born as a language to be simple even for inexperienced programmers, which is why it accepts code written with a range of issues. ES5 has introduced innovations that partly remedy this conception. The strict mode can be applied either to the entire javascript program or to individual functions. The modules introduced in ES6 already operate in strict mode. DIFFERENCES BETWEEN NORMAL MODE AND STRICT MODE The code below illustrates some of the differences between normal mode and strict mode. STRICT MODE AND THIS This in normal mode is [...]

By |2024-11-11T18:38:18+00:00December 8, 2022|0 Comments

REGULAR EXPRESSIONS IN JAVASCRIPT

REGULAR EXPRESSIONS IN JAVASCRIPT Knowing about regular expressions is very important when we work with data because they allow us to do particular checks on a string, such as whether there is a certain combination of characters, whether there are phone numbers, e-mail addresses, and so on. Thanks to the methods provided by javascript we can extract this information and put it into an array. A typical use is validating form fields, managing a password etc. Instead of operating directly on the javascript code we will initially do our tests on the site regexr.com. whose link I leave you. [...]

By |2024-11-11T18:40:59+00:00December 11, 2022|0 Comments

SYMBOLS, ITERATORS AND GENERATORS

THE PRIMITIVE TYPE SYMBOL Symbol is a new JS data primitive introduced with the 2015 ECMA specification (ES6). A symbol represents a unique and anonymous value. To create them, we cannot use literal syntax but use the type Symbol. Symbols are very useful when we want to avoid property conflicts on an object. Another example of use is when we want to pass a unique, nonreplicable value to a function. SAMPLE CODE IMPLEMENT ITERATOR PROTOCOL An iterator to be such must be able to access a sequence of elements one at a time. Having implemented the [...]

By |2024-11-11T18:41:31+00:00December 16, 2022|0 Comments
Go to Top