Blog

Page 795 of my articles, tutorials, and thoughts

Latest Articles

Cover Image for pretty-print JSON using JavaScript
javascriptjsonpretty-print

pretty-print JSON using JavaScript

Published on June 27, 2021

# 🌟 Easy and Pretty JSON Printing with JavaScript! πŸ“ Are you tired of staring at ugly, cluttered JSON data? Want to make it easier for human eyes to comprehend? Look no further! In this blog post, we'll address the common issue of pretty-printing JSON u

Cover Image for How can I change an element"s class with JavaScript?
domhtmljavascript

How can I change an element"s class with JavaScript?

Published on June 26, 2021

# How to Change an Element's Class with JavaScript: A Simple Guide πŸ‘¨β€πŸ’» Have you ever wondered how to dynamically change an element's class in your HTML using JavaScript? πŸ€” Whether you want to apply different styles to an element based on user interacti

Cover Image for Creating multiline strings in JavaScript
heredocjavascriptmultilinestring

Creating multiline strings in JavaScript

Published on June 25, 2021

## Creating Multiline Strings in JavaScript: Simplified! 😎 So, a friend of mine recently came to me with a piece of code written in Ruby and asked for its JavaScript equivalent. The code included a multiline string. After some thought, I realized that th

Cover Image for How do I format a date in JavaScript?
datedate-formattingjavascript

How do I format a date in JavaScript?

Published on June 24, 2021

# How to Format a Date in JavaScript πŸ“… So you want to format a JavaScript `Date` object as a string? Preferably in the format: `10-Aug-2010`? No worries, we got you covered! In this guide, we'll walk you through the common issues, provide easy solutions,

Cover Image for What is the difference between call and apply?
dynamicfunctionjavascriptperformance

What is the difference between call and apply?

Published on June 23, 2021

πŸ“žπŸ€™CALL vs. APPLY: 🧩Understanding the Difference and When to Use Each πŸ”„ Hey tech enthusiasts! πŸ‘‹ In today's blog post, we're going to uncover the secrets behind the often-confusing duo of `Function.prototype.apply()` and `Function.prototype.call()`. πŸ€”

Cover Image for How can I convert a string to boolean in JavaScript?
boolean-expressionboolean-operationsjavascriptstring-conversion

How can I convert a string to boolean in JavaScript?

Published on June 22, 2021

# Converting a String to Boolean in JavaScript πŸ”„πŸ”€πŸ”ƒ Have you ever encountered a situation where you needed to convert a string representing a boolean value into an actual boolean type in JavaScript? If you have, you're not alone! Many developers face th

Cover Image for How do I loop through or enumerate a JavaScript object?
eachfor-loopjavascriptloops

How do I loop through or enumerate a JavaScript object?

Published on June 21, 2021

# How to Loop Through or Enumerate a JavaScript Object πŸ”„πŸ”’ Are you struggling with looping through or enumerating a JavaScript object? πŸ€” Don't worry, we've got you covered! In this guide, we'll address this common problem and provide you with easy solut

Cover Image for What is the JavaScript version of sleep()?
javascriptsleep

What is the JavaScript version of sleep()?

Published on June 20, 2021

# πŸ’€ Mastering the Art of JavaScript Sleep πŸ’€ Have you ever wished for a magical ✨ sleep function ✨ in JavaScript that could pause the execution of your code for a certain amount of time? Maybe you wanted to create a suspenseful effect or simulate a delay

Cover Image for How do I test for an empty JavaScript object?
javascriptjavascript-objects

How do I test for an empty JavaScript object?

Published on June 17, 2021

# How to Test for an Empty JavaScript Object πŸ§ͺπŸ” So, you made an AJAX request and sometimes you get an empty object as the response. Don't worry, we've got you covered! In this guide, we'll walk you through the process of testing for an empty JavaScript