Categories for JavaScript

February 17, 2020
Turn a string into a number using JavaScript

Like most things in JavaScript, a string can be turned into a number in lots of different ways. However, there is one way which is particularly easy to implement. Simply place a ‘+’ before your variable to convert it to an integer. const number = ‘123’ const convertedNumber = +number If you don’t believe me… View Article

February 12, 2020
Shorthand Ternary Operators in Vanilla JavaScript

In a recent project I’ve been working on, I found writing out Ternary operators very tiring, especially after doing around 50 – 100 of them when checking data from an API. They looked something along the lines of this: (if this exists, print this, or print something else) ${person.PERSON_NAME ? person.PERSON_NAME : ‘There is no… View Article