Mindblown: a blog about philosophy.
-
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: ArrayBuffer ArrayBuffer, Uint8Array, DataView Uint8Array Blob, and so on. In JavaScript, binary data is performed in a non-standard way. But, it becomes simple after getting into some details. ArrayBuffer…
-
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…
-
JavaScript Export and Import
Having a complex application makes developers scroll through hundreds and thousands of lines of code, which makes it harder for them to debug or even understand the app. Luckily, JavaScript allows overcoming such difficulties. Having import and export helps one out of the problems above. There are several syntax options for export and import directives. In the…
Got any book recommendations?