Daily Shaarli

All links of one day in a single page.

January 3, 2022

loicsuberville on Twitter: "French makes absolutely no sense… https://t.co/Yf3aEZduOv" / Twitter

personne (adjectif) <-> une personne
louer (bailleur) <-> louer (locataire)
hôte (qui reçoit) <-> hôte (qui est reçu)
plus (+) <-> plus (rien) → "As the double negation vanishes in oral language, you have "J'en veux plus" (mute final S) which means the opposite of "J'en veux plus" (pronounced final S)." @GuigoDalphinus

Il s'agit d'énantiosémie

Deep-copying in JavaScript using structuredClone

Problems with deepcloning with JSON.stringify() / JSON.parse():

  • Recursive data structures: JSON.stringify() will throw when you give it a recursive data structure. This can happen quite easily when working with linked lists or trees.
  • Built-in types: JSON.stringify() will throw if the value contains other JS built-ins like Map, Set, Date, RegExp or ArrayBuffer.
  • Functions: JSON.stringify() will quietly discard functions.

The solution: the function structuredClone.