Like @jordan
explained, Javascript is weird. But examples like let and var is an attempt to solve this not another weirdness. I had one of my most disturbing bugs recently, I completely forgot typeOf NaN === number. That is literally saying 'not a number` is a number.
But just like the English language understanding this weirdness is the only way you can call yourself a fluent speaker of the language. In English you could say 'Giver her her book', but never "Give him him book". "How are you" is supposed to be for a singular person, but "are" in every other situation is plural. We just accept this "bug" and appreciate the more expressive part of the language.
I understand the point you made regarding English language, but comparing shortcomings of English language with a programming language is like comparing human brain with AI.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Like @jordan explained, Javascript is weird. But examples like
let
andvar
is an attempt to solve this not another weirdness. I had one of my most disturbing bugs recently, I completely forgottypeOf NaN === number
. That is literally saying 'not a number` is a number.But just like the English language understanding this weirdness is the only way you can call yourself a fluent speaker of the language. In English you could say 'Giver her her book', but never "Give him him book". "How are you" is supposed to be for a singular person, but "are" in every other situation is plural. We just accept this "bug" and appreciate the more expressive part of the language.
I understand the point you made regarding English language, but comparing shortcomings of English language with a programming language is like comparing human brain with AI.