Daily Shaarli

All links of one day in a single page.

April 26, 2023

The “const” Deception

const only ensures that the reference is not modified. The data referenced can be modified though.
Also, primitive data types are immutable. So a const a = 5 can not be updated as 5 as Number can not change.

When we use const, we create an indestructible link between a variable name and a piece of data. We're still allowed to modify the data itself though!

Open Source Guides | Learn how to launch and grow your project.
Casse du siècle : 250 milliards passés du travail au capital, dans un silence assourdissant - L'insoumission

La comparaison vaut le détour: quelle est la part de production du travailleur par an dédié au rendement du capital?

La part revenant aux salariés a en effet chuté dans le pays. Elle était de 75% au début des années 80, elle stagne autour de 65% aujourd’hui (source : INSEE).

Dans le même temps, 157 milliard d'euros sont versés sans contrepartie aux grandes entreprises.

Exploring The Potential Of Web Workers For Multithreading On The Web — Smashing Magazine

How to create a web worker?

  1. Create a script that imports another one with const worker = new Worker('worker.js'
  2. Bind events emitted by the worker with worker.onmessage = function(event) { ... }
  3. Do the same in the web worker with self.onmessage = function(event) { ... }
  4. Exchange messages with worker.postMessage(payload) or self.postMessage(payload)

One key difference between Web Workers and the main thread is that Web Workers have no access to the DOM or the UI. This means that they cannot directly manipulate the HTML elements on the page or interact with the user.