Johnny

@smpnjn

3777 Points 59 Followers

202 Posts

0 Answers

Engineer, Product

Johnny · 1 year ago

v-show vs v-if: Conditional Rendering in Vue

v-if and v-show are two ways to conditionally render content in Vue. Both are built to conditionally render content in Vue, but in slightly different ways - which can be quite confusing. Let...
1

Johnny · 1 year ago

Checking if a value is a number in Javascript with isNaN()

In Javascript, we have numerous ways to check if something is or is not a number. This is a particularly common task in Javascript, where there is dynamic typing, resulting in some unexpecte...
3

Johnny · 1 year ago

Javascript Arrays - How to Remove Duplicate Elements

Javascript arrays can contain duplicates - which is fine most of the time, but can sometimes cause some issues. For example, if an array is supposed to only contain unique user IDs, but is t...

Johnny · 1 year ago

Javascript Arrays

Arrays in Javascript are a simple, one dimensional way to store simple sets of data. Arrays are non unique, which means they can store duplicates (unlike sets). They also follow typical prot...

Johnny · 1 year ago

Javascript toLowerCase() - Convert Strings to Lowercase

a String is a type of data in Javascript, and as with any other type of data, Strings have prototypes and therefore inherit standard methods. One of these methods is toLowerCase(), which you...

Johnny · 1 year ago

How to Check if Object is Empty in JavaScript

Defining a new object in Javascript is pretty easy - but what if you want to find out if it's empty? For example, {} is an empty object, but how do we actually test that this is the case? le...

Johnny · 1 year ago

Javascript Promise.all() - Everything you need to know

The Promise.all() method in Javascript is a function which accepts many promises, and then does something only after they have all been settled. From all the promises you enter into it, it c...

Johnny · 1 year ago

Javascript innerHTML

In Javascript, we have lots of different ways to manipulate DOM elements. DOM elements are the HTML elements we define when we write our scripts. Once we are targetting a particular DOM elem...

Johnny · 1 year ago

Centering Elements in CSS with Tailwind

Tailwind is an increasingly popular and widely used framework, which makes it easier in some cases to build and ship features and products. In this guide, we'll be covering how you can verti...
1

Johnny · 1 year ago

Getting Started with Redis and Node.JS

Redis is a powerful tool for caching data and having it available in memory. Redis requires RAM to use, and every piece of data you use in Redis is loaded into the RAM. That means it can be...
3

Johnny · 1 year ago

Javascript Array Some Method

I've already covered in another article the Javascript every method. It's useful for when checking if every element matches a certain criteria. The some method differs in that it checks if o...

Johnny · 1 year ago

Javascript: Check if an Array is a Subset of Another Array

There are many use cases where knowing if an array is a subset of another can be quite useful - and although usually immediately obvious to the human eye, it can be difficult to evaluate in...

Johnny · 1 year ago

Javascript Array Every Method

Sometimes with arrays, we want to test every element for a certain condition. While individual conditions can be tested easily with an if statement, it becomes a little trickier with multipl...

Johnny · 1 year ago

Creating and Generating UUIDs with Javascript

Universally Unique Identifiers (UUIDs) are used all over the place in software development for everything from identifying object elements to DOM elements on a web page. They are unique, 128...

Johnny · 1 year ago

Javascript Array Concat Method

The concat method on arrays is used to take two arrays and concatenate them into one. It takes as many arrays as you like - so you can concatenate many arrays at once: Array.concat(value1, v...

Johnny · 1 year ago

Javascript Immediately invoked function expressions (IIFE)

Immediately invoked function expressions, or IIFE, are functions which are run as soon as you define the function. You may also see people refer to them as anonymous functions. They give us...
3

Johnny · 1 year ago

Javascript loops: for vs forEach vs for.. in vs for.. of

There are quite a few ways in Javascript to loop through an array of items or any other iterable item in Javascript. You may have seen them: arr.forEach() for(let item of arr) for(let...
1

Johnny · 1 year ago

Removing the last element of an array in Javascript

One of the most frequent operations we perform on an array is removing the last element. There are a few different ways to do this - but one of the most common is to use the pop() method. Co...
1

Johnny · 1 year ago

Javascript Ordinals: Adding st, nd, rd and th suffixes to a number

In Javascript it's usually considered best practice to work with absolute numbers, as number is a defined type. However, when expressing these numbers in user interfaces, it's more likely we...

Johnny · 1 year ago

Git: Renaming a Branch

Git branches are an easy way to manage our code, and separate our copies of our code when we want to work on specific features. We can then merge our code back into our main branch, or even...
2

Johnny · 1 year ago

Git Merge: Merging Changes from other Branches

Git provides a powerful tool by letting us create branches. When our branch is done, we'll often want to merge it back into our main or master branch - or perhaps even merge it into another...
4

Johnny · 1 year ago

Resolving Git Merge Conflicts

Merge conflicts are often a part of life for working on complex development projects. In this guide we'll look at how you can deal with them, and when they will occur. When do merge conflict...
4

Johnny · 1 year ago

A Step by Step Guide to Git Branches

In my previous guide on getting started with git, I briefly covered how git branches work. You can create new branches using the git branch command, for example. In this guide, we'll go in d...
1

Johnny · 1 year ago

Javascript Shallow Copy - what is a Shallow Copy?

Shallow copy and deep copy are terms thrown around in Javascript that can be confusing if you have never heard them before. It is quite common to hear that array methods like slice or filter...

Johnny · 1 year ago

CSS Individual Transform Properties

CSS transforms are a useful way to translate, rotate, and create 3d objects in CSS. I covered previously how CSS transforms work here, and I also created a 3d Minecraft chicken to show how y...

Johnny · 1 year ago

Javascript Proxy: Using Javascript Proxies like a Pro

Proxies are objects in Javascript which allows you to make a proxy of an object, while also defining custom behaviour for standard object operations like get, set and has. What that means is...

Johnny · 1 year ago

The Complete Beginners Guide to Getting Started with Git

Git can be daunting to understand since it is completely driven from the terminal, but at its core it's just version management software. It lets us maintain versions of code, which other pe...

Johnny · 1 year ago

What are NodeLists, and how do they work?

Did you know that Javascript does not class a selection of multiple elements as an array? Instead, it is something called a NodeList. A node list is essentially a list of elements. To genera...

Johnny · 1 year ago

Javascript Add Event Listener to Multiple Elements

If you've ever worked in vanilla Javascript, you might be familiar with adding event listeners to elements using the following formula: let element = document.querySelector('#button'); elem...

Johnny · 1 year ago

Javascript Array Filter Method

The filter method in Javascript creates a shallow copy of an array, filtering it based on a number of conditions. It accepts a callback function. The array which filter produces will usually...
1

Loading More Content