Javascript is the most popular scripting language in use today

Javascript is the most popular scripting language in use today

L
[email protected]z serwisu Lemmy, 3 godz. temu

Mem ze społeczności [email protected] w serwisie Lemmy, autor theory, 19 lipca 2023. Explanation: it's mostly due to how js does type conversion. for the Ls, it's >[] is an empty array >![] is treated as false >combining a boolean with the empty array returns "false" as a string (so true + [] = "true", false + [] = "false") >! + [] is treated as true >! + [] +! + [] is treated as 2 since true + true = 1 + 1 = 2 >so you have "false"[2], which is l for the o it's >[] is an empty array >[] + {}…

Źródło

Autor: theory, serwis Lemmy, opublikowano 19 lipca 2023.

Obrazek wyświetlamy prosto z serwisu Lemmy ([email protected]), bez kopiowania.

Oryginał w serwisie Lemmy

Jesteś autorem i chcesz, żeby to zniknęło? Zgłoś, usuniemy.

Dodano 17 listopada 2026, tematy: programmer_humor, dział Technologia.

Podobne gnioty