-
JavaScript Blob
The browser has additional high-level objects. Among them is the Blob. The Blob object visualizes a blob that is a file-like object of immutable. The Blob is a raw data: you can read it both as binary data or text. It consists of an optional string type, blobParts, strings, as well as BufferSource. Constructing a Blob For constructing a Blob from other data and non-blob objects, the Blob() constructor…
-
JavaScript TextDecoder and TextEncoder
In this chapter, we are going to explore TextEncoder and TextDecoder in JavaScript. Imagine that the binary data is a string. For example, getting a file with a textual data. With the help of a built-in TextDecoder object, it is possible to read the value into a JavaScript actual string, with the encoding and the buffer. First of all,…
-
JavaScript ArrayBuffer, Binary Arrays
In web-development, binary data is generally used while working with files ( for instance, creating, uploading, downloading). JavaScript allows doing it all. Multiple classes exist, among them are: In JavaScript, binary data is performed in a non-standard way. But, it becomes simple after getting into some details. ArrayBuffer ArrayBuffer is known as the basic binary object. It is…
-
JavaScript Cross-window Communication
The Same Origin policy restricts the windows access to one another. That means, if a user has opened two pages: the first one from daivd-brown.com and the second one – gmail.com, then they couldn’t want a script from daivd-brown.com for reading a mail from gmail.com. The purpose of such a policy is to protect users from information theft. Describing the Same…
-
JavaScript Popups and Window Methods
One of the oldest methods of showing an additional document to the user is a popup window. Here is an example of running a popup window: Running the code above will open a new window with a particular URL. Modern browsers are configured for opening new tabs instead of separate windows. The initial idea of…
-
JavaScript BigInt
There is a specific numeric type, providing support for integers of arbitrary length. It’s known as biting. You can create a bigint by appending n to the end of an integer literal. Another way of creating a bigint is to call the function BigInt, which generates bigints from numbers, strings, and so on. Let’s see it in action:…
-
JavaScript Currying
In JavaScript, there exists an advanced technique of working with functions. It is called carrying. However, it is used not only in JavaScript but also in other programming languages. Generally, it is a transformation of functions.So, it translates a function from callable likef(a, b, c) to f(a)(b)(c) . A function can’t be called by currying. What it does is merely…
-
JavaScript Eval
In this chapter, you will see how a JavaScript built-ineval() function works. Normally, it is used for evaluating a JavaScript code, which is represented as a string. The syntax of the eval() function is the following: For a better perception, you can check out the following example: Eval is considered a function property of the global object. As a rule, the eval() function’s argument is…
-
JavaScript Proxy and Reflect
Proxies are commonly applied in various libraries and several browser frameworks. A Proxy object is used for wrapping another object and intercepting operations such as writing and reading properties, dealing with them, or transparently making the object to handle them. Proxy The first thing to know is the syntax of proxy, which looks as follows: This syntax…
-
JavaScript Dynamic Imports
Dynamic imports are slightly different from static imports. While static imports have a range of limits, dynamic ones are more flexible and multidimensional. For instance, static imports are limited to the top level of the file, can’t be loaded conditionally (inside if), and the name of the package might not be determined during execution. Instead, all…
