Bubble sort in JavaScript

Sorting is the process of arranging a sequence of objects in a particular order. You can sort any entities that can be compared. Imagine an online store. You enter your query into the search bar and you get a list of results....

February 20, 2021 路 2 min 路 Coderslang Master

Algorithm complexity and efficiency

All algorithms have 2 main characteristics: Amount of required memory. Execution time. These two are used to compare algorithms with each other. Some algorithms are faster, but require more memory, while others are vice versa....

February 19, 2021 路 3 min 路 Coderslang Master

JS Interview #39: How does `setTimeout` work inside the `for` loop?

What will be logged to the console? . . . . . . . . . . . . . . . . . Before we analyze the code snippet, let鈥檚 try to simplify it by removing the setTimeout....

February 19, 2021 路 1 min 路 Coderslang Master

HTML, how to add a comment

To add a comment into an HTML document, there鈥檚 a special tag <!-- comment -->. There are times when you need to add comments to an HTML page. Comments are text that will be visible to your colleagues, but not visible to users who browse your website....

February 18, 2021 路 2 min 路 Coderslang Master

JavaScript, using Math.floor to round a number

In JavaScript there are a couple of ways of rounding a number. The function Math.floor rounds the number down. It accepts a number n and returns the biggest integer that鈥檚 less than or equal n....

February 17, 2021 路 2 min 路 Coderslang Master

HTML, insert an image into the page

To insert an image into the HTML document, you can use the tag <image>. This HTML tag has 2 key attributes: src 鈥 defines the path to the image file alt 鈥 sets the alternative text....

February 16, 2021 路 2 min 路 Coderslang Master

JS Interview #38: Can you add multiple arrays in JavaScript?

Can you add multiple arrays in JavaScript? What鈥檚 the output? . . . . . . . . . . . . . . . . . . The function add(x, y, z) applies the + operator to the provided arguments....

February 16, 2021 路 1 min 路 Coderslang Master

JavaScript, calculate a square root using Math.sqrt()

To calculate the square root of the number in JavaScript, you can use the function Math.sqrt(). You pass in a number, and it returns the square root of this number....

February 15, 2021 路 1 min 路 Coderslang Master

JavaScript, remove last character from a string

JavaScript strings are immutable. This means that once the string was created it can鈥檛 be changed. When you need to remove the last character from a string in JavaScript, you should create a new string without this character....

February 14, 2021 路 2 min 路 Coderslang Master

JavaScript, Promise creation and Promise chains

In this tutorial you鈥檒l learn how to create JavaScript Promises, how to handle promise chains and utilise the functions Promise.all and Promise.race. ...

February 13, 2021 路 5 min 路 Coderslang Master