Dev.to WebDev 🛠 Dev 👁 0

An AI explained JavaScript in four lines. One of them is wrong.

We asked Aria, our AI, for four quick JavaScript facts. She was completely sure about all of them: 1. const stops you from reassigning the variable. 2. typeof null returns "object". 3. 0.1 + 0.2 === 0.3 is true. 4. Ar

We asked Aria, our AI, for four quick JavaScript facts. She was completely sure about all of them:

1. const stops you from reassigning the variable.
2. typeof null returns "object".
3. 0.1 + 0.2 === 0.3 is true.
4. Arrow functions don't get their own this.

One line is wrong. Pick yours before you scroll.

.

.

.

.

.

It's line 3. Numbers in JavaScript are floating point, so 0.1 + 0.2 is 0.30000000000000004 and the check is false. Line 2 looks wrong but is true, and it's been that way since the first version of the language.

We turned this kind of thing into a free game. Aria answers a coding question in 5 or 6 lines and you tap the one that's wrong, then pick why. Pick from tracks like frontend, Python, SQL or AI. Five rounds take about five minutes on a phone.

Our October event closes Monday 19 Oct at 11:59 pm IST, and the top 10 get LogicWiz goodies delivered home.

Play it here: https://arena.logicwiz.ai/club/BJSRBK?utm_source=devto-js

Did line 2 trick you?

📰 Read the original article on Dev.to WebDev

Originally published by Dev.to WebDev. Aggregated on AIWithGhost for educational purposes — full credit and traffic to the original publisher.