Tag: JavaScript
-
Ternary! ☘️
If you find yourself with a conditional in the form on an if else, there’s a more concise way of writing it. Say hello to a ternary. Take this code: Simple enough, but using a ternary we can do even better: So how’s this thing structured? Basically, we start with the item we are checking…
-
Mutation === 💩
One of the many things I’ve picked up from the excellent Syntax podcast over the years is mutation should be avoided. Today a came across a great example of this with the reverse array method. I had some code that looked something like this: To my surprise the resulting output of the console logging was…
-
YelpCamp
I’ve now reached a turning point in my web dev course. This morning I started writing code on my first meaty project, YelpCamp. As the name implies the YelpCamp project is Yelp but for campsites. The idea isn’t to release this as a service that people will actually use. The intent is to combine what…
-
Express snippets
Since I’m playing with Express at the moment I’ve updated my collection of snippets to include a few things I seem to be doing regularly: Express setup I use the shortcut “myExpressSetup” to kick off all my new Express projects. It has basically all the parts I need to get the project underway, and means…
-
NPM and a Demon
So learning node.js has been really interesting so far, I’m quite taken by it. It’s great being able to transfer my JavaScript skills from frontend to backend. One of the things I’m enjoying most about it is NPM. By their own definition: NPM is the world’s largest software registry. Open source developers from every continent…
-
I made a thing: Aroha generator
So I made another thing. The only reason I’m really even talking about it is because what’s going on in Christchurch is so awful I can hardly bear it. Making new things (even simple things like this) is a good distraction. So in an effort to cheer myself up I made a web thing that…
-
Constantly letting down my variables
As it turns out I’ve been doing everything wrong. Well, maybe not everything, but at the very least I’ve been declaring variables incorrectly. There are actually three different variable types in JavaScript, var, let, and const. I’ve been using var exclusively and it’s actually bad practice. So what’s the difference between each and which should…
-
How to write modern JS
So you’re learning JavaScript (JS), cool. Putting all this effort in, you’ll want to be learning the modern usage of the language right? Time to get strict. “use strict” is something I recently stumbled across, and it seems like a really important thing to be using. So much so that I’m a bit surprised it…
-
I made a thing: To-do list
Yep, I made another thing in JavaScript for the course I’m doing. This one’s a bit more basic, but really it’s more of cutting my teeth with jQuery sort of project rather than something anyone would actually use. It’s a very simple todo list app that lets you add and remove items from a simple…