javascript

What's wrong with JavaScript sort() function

published on
This year I decided to solve the famous Advent of Code Challenge in both Python and JavaScript. I’m also gonna be posting my solutions on my GitHub repository. And while solving today’s advent of code challenge, in javascript. I came across a weird behaviour of the sort() function in javascript. I was trying to sort an array of numbers, and I was using the sort function like this: const myArray = myArray. Read More...

Type Coercion In JavaScript

published on
This small blog was sparked by a post that I saw: There are many posts like the above on the internet, and almost all of them are because of this type coercion thingy. So in this blog, I’m gonna try to explain what type coercion is and what’s happening in that post 😉. What is type coercion? There are 6 primitive data types in JavaScript: undefined, Boolean, Number, String, BigInt and Symbol. Read More...