Newest Articles

javascript exercises beginners

Convert an object to array in JS

Friday, January 22, 2021

Converting an object to an array is pretty easy in JavaScript. All we have to do is use Object.keys, or an even easier method to use, Object.entries.

javascript exercises beginners

Get an object's length in JavaScript

Thursday, January 21, 2021

To get the length of an object in JS, we use Object.keys() to get an array of our object's own properties' keys. Then we can easily return the length value.

javascript exercises beginners

Build a multi-dimensional array in JavaScript

Monday, January 18, 2021

How to build matrices in JS? Also known as multi-dimensional arrays, these are just arrays of arrays in JS. An easy way to build multi-dimensional arrays is to output them using nested loops, as we'll show in this tutorial.

javascript exercises beginners

Convert kebab case to camel case in JavaScript

Monday, January 18, 2021

It's the combination of String.prototype.match(), RegExp, and String.prototype.replace() that gives us the solution to coverting a kebab case string to camel case string in JS.

javascript exercises beginners

Capitalize the first letter of a string in JavaScript

Monday, January 18, 2021

The trick is to separate the string into the first letter and the rest of the string using charAt() and slice(), then run the toUpperCase() method on the first substring, and concatenate the rest of the original string back to the uppercased first letter.

javascript exercises beginners

Insert CSS styles with JavaScript

Sunday, January 17, 2021

Appending a style tag to the head tag of an HTML document requires some simple DOM manipulation. In this tutorial, we'll discuss how to do this, and all the other ways of adding styles using JS.

javascript exercises beginners

Compute the factorial of a number with JavaScript

Sunday, January 17, 2021

Calculating a factorial is very easy, but many JS implementations online make this problem unnecessarily complex. In this tutorial, we'll see the basics of how to calculate a factorial in JavaScript. We'll also go through the explanation of building a factorial calculating function in JS step-by-step.

javascript exercises beginners

Calculate the Fibonacci sequence in JS

Saturday, January 16, 2021

Fibonacci sequence in JS should not be hard to build. In this article, we show step-by-step, how to build in a few simple steps, a rudimentary fibonacci sequence. Once we know the basic mehanism that lies behind the logic of fibonacci sequence code, we can then build more complex code based on this foundation.

javascript exercises beginners

Count the number of times a substring appears in a string in JavaScript

Friday, January 15, 2021

Have you ever tried to see how many times a letter or a word appears in a string? Or how many times a value is repeated in an array? This tutorial shows you how to figure that out in JS.

javascript exercises beginners

Convert an array of numbers to an array of ordinal numbers in JS

Thursday, January 14, 2021

To format an array of numbers as ordinal numbers, we need to properly add the suffixes -st, -nd, -rd, and -th to correct numbers. This includes numbers 11, 12, and 13, which are a bit of an edge case. In this article, we discuss how this works.

Feel free to check out my work here: