How can I deep freeze an object in JavaScript?
Learn how mutability works in JavaScript, its applications to objects and how you can properly freeze them to make them constant.
30 seconds of code contains a curated collection of code articles covering a wide range of development needs. The collection spans many topics, ranging from simple coding problems to theoretical concepts and development techniques.
Learn how mutability works in JavaScript, its applications to objects and how you can properly freeze them to make them constant.
Learn how to detect whether a page is being viewed on a mobile device or a desktop.
Learn how to pluralize a string in JavaScript based on a number.
If you've ever needed to check if the bottom of the page is visible, this article will help you do just that.
Use simple DOM queries to find all the images contained within an element.
Get the time part of a Date object in the format HH:MM:SS.
Learn how to escape a string to use in a regular expression.
Copy the sign of one number to another without changing its absolute value.
Use the Proxy object to implement the Observable pattern in JavaScript.
Having a hard time wrapping your head around the math involved in checking for leap years? You might not need to!
Search for substrings in JavaScript strings without worrying about case sensitivity.
Having trouble with inconsistent line endings in your strings? Normalize them with this handy JavaScript function!
Did you know you can use JavaScript to toggle fullscreen mode for an element on a webpage? Let's learn how!
Learn how to extract command-line arguments passed to a Node.js script.
Get the name of the weekday from a JavaScript Date object.
Parse a text file and return an array of lines, synchronously or asynchronously, using Node.js.
Indent each line in a string by a specified number of spaces or a custom indentation character.
Remove non-printable ASCII characters from a string in JavaScript.
JavaScript variables can be declared a handful of ways. However, understanding their differences can drastically change the way you code.
Check if a value can be safely converted to a number in JavaScript.
Learn how to calculate the angle (theta) between two vectors in JavaScript.
Calculate the midpoint between two pairs of points in a 2D plane, and beyond.
Given a value, find out how many times it appears in an array or string.
Ever wanted to reload a module in Node.js? Here's how you can do it.