Just The Code Please

How to use the Javascript Fetch API with Promises

January 16th 2024

Many examples on the internet of the javascript fetch api use async and await. This is great, but sometimes its helpful to use promises instead. Here are some examples of how that is done.

How to check if two arrays contain the same values in Javascript

January 16th 2024

Sometimes we need to determine if two arrays contain the same values. This article shows several ways to do that in Javascript.

How to reload a page using Javascript

January 16th 2024

Here's a useful function. Sometimes we need to refresh a page using Javascript. This function can be called whenever you need it.

How to copy text to the clipboard using Javascript

January 16th 2024

Copying text to the clipboard is something users to all the time. To make life a little easier on them, it can be good to provide them with a button which copies specific text to the clipboard. Here is how to implement this kind of button in Javascript.

How to retrieve the value of a select element using Javascript

January 16th 2024

A lot of the time in Javascript we are handling user input. Select elements are very common to see in user interfaces and we need to retrieve the item users have selected. Here is some code I've found useful to help with this.

How to check if an Array can be treated like a Set in Javascript

January 16th 2024

It's common to see arrays used like sets in Javascript. This function checks to see if all values in an array are unique and are the same type. I've found this to be useful in some of the projects I've worked on, I hope you will too!

How to center an element using Flexbox

January 9th 2024

Centering stuff in CSS can be confusing at first. There are many ways to do it. Flexbox provides us with one of the simpler methods of centering things. This article shows how to use Flexbox to center DOM elements horizontally and vertically.

How to center an element horizontally using margins

January 9th 2024

One of the easiest ways of centering elements horizontally in CSS it to use margins. It is common to see this on approach used with wrapping container elements. This article shows you how.

How to remove new lines from text in Javascript

January 9th 2024

From time to time we need to manipulate text in the browser. It's common to work with text that contains new lines. Sometimes this isn't ideal, and we need to remove them. This is how you do it!

How to center an element using CSS Grid

January 9th 2024

A more recent addition to our CSS toolbox has been a technology called CSS Grid. It has many uses and it's designed to help us precisely position elements on a webpage. This can help a great deal when it comes to centering elements. Here is how we can use CSS Grid to center things.

How to vertically center an element with CSS

January 9th 2024

Centering stuff in CSS can be tricky. Centering elements vertically can be especially problematic because most webpages are deigned to expand vertically when there is more text. This article shows the various ways you can vertically center an element with CSS.