Reading Time: 6 minutesHave you ever sat down to write a bit of JavaScript thinking, “this is easy; shouldn’t take more than a few minutes,” and then six hours later there you are with a bottle of whisky in one hand and a … Continue reading
Tag: Weird JavaScript
Weird JavaScript: Arrays and the weird ways we can(‘t) define them
Reading Time: 8 minutesThe JavaScript array. A simple, elegant data structure. Easy to make them. Easy to add data to them. Easy to sort them. Easy to iterate on them. What could possibly be weird about JavaScript arrays?
Why does JavaScript have null AND undefined?
Reading Time: 3 minutesA complaint I hear sometimes from folks programmers learning JavaScript is that it has both null and undefined. If JavaScript is your first programming language, this may not seem weird, but once you compare it to others… yeah, it’s strange. … Continue reading
Weird JavaScript: How to make enemies with type coercion
Reading Time: 2 minutesWho cares about friends? How would you like to piss of Todd who won’t shut up about this season’s IPAs and Elon Musk’s 4D chess he’s playing on Twitter? Screw Todd. No one likes him and he deserves to hurt … Continue reading
Weird JavaScript: Why does JavaScript have a === ?
Reading Time: 2 minutesThis is another one in the occasional series of, “weird JavaScript” where I address weird stuff in JavaScript that only haunts your nightmares if you dream in other programming languages. Today we discuss what the hell === actually does. Buckle-up … Continue reading
Weird JavaScript: Why do you get an empty string when you add arrays?
Reading Time: 2 minutesI’m going to have an occasional series about weird stuff in JavaScript. Let’s kick this off with a weird question: Why is it that when you have [] + [], you get an empty string (”) ? Isn’t this against … Continue reading