JavaScript Tutorials & Protips

Protip

JavaScript DOM — Prevent default action of an event

Learn how to prevent the default action of an event by using the Event.preventDefault() method in JavaScript.

JavaScript
Protip

JavaScript DOM — Stop propagation of an event

Learn how to stop the propagation of an event in both capturing and bubbling phases using the Event.stopPropagation() method in JavaScript.

JavaScript

How to get all own properties of an object in JavaScript

A quick guide to learn how to get all own properties of an object in JavaScript.

JavaScript

Own and inherited properties of an object in JavaScript

Learn about the own and inherited properties of an object in JavaScript and how they differ from each other.

JavaScript

How to check if a property exists in an object in JavaScript

Learn about 3 different ways to check if an object contains a specific property in JavaScript.

JavaScript

How to convert an object to an array in JavaScript

A detailed article to learn how to convert an object to an array in JavaScript.

JavaScript
Protip

JavaScript DOM — Get the offset position of an element relative to its parent

Learn how to get the offset position of an element relative to its parent in JavaScript.

JavaScript
Protip

JavaScript DOM — Get the scrollbar width of an element

Learn how to get the scrollbar width of an element by using JavaScript.

JavaScript
Protip

JavaScript DOM — Replace a CSS class of an element

Learn how to use the replace() method of the classList property to replace a CSS class of an element in JavaScript.

JavaScript
Protip

JavaScript DOM — Toggle a CSS class of an element

Learn how to toggle a CSS class of an HTML element by using the classList property of the element in JavaScript.

JavaScript
Protip

JavaScript DOM — Remove a CSS class from an element

Learn how to use the classList property to remove one or more CSS classes from an HTML element in JavaScript.

JavaScript
Protip

JavaScript DOM — Add a CSS class to an element

Learn how to add one or more CSS classes to an HTML element by using the classList property in JavaScript.

JavaScript
Protip

JavaScript DOM — Get the width and height of the window

Learn how to get the width and height of the window in JavaScript.

JavaScript
Protip

JavaScript DOM — Get and set scroll position of the document

Learn how to get and set the scroll position of the document in JavaScript.

JavaScript
Protip

JavaScript DOM — Get and set scroll position of an element

Learn how to get or set scroll position of an element by using scrollTop and scrollLeft properties in JavaScript.

JavaScript
Protip

JavaScript DOM — Get height and width of an element

Learn how to get the height and width of an HTML element by using offsetHeight and offsetWidth properties in JavaScript.

JavaScript
Protip

JavaScript DOM — Remove an attribute from the element

Learn how to remove an attribute from an HTML element using the removeAttribute() method in JavaScript.

JavaScript
Protip

JavaScript DOM — Set the value of an attribute

Learn how to use the setAttribute() method to set the value of the attribute of an HTML element in JavaScript.

JavaScript
Protip

JavaScript DOM — Get the value of an attribute

Learn how to get the value of an HTML element's attribute by using the getAttribute() method in JavaScript.

JavaScript
Protip

JavaScript DOM — Check if an element has children

Learn how to check if an HTML element has children by using the hasChildNodes() method in JavaScript.

JavaScript

✨ Learn to build modern web applications using JavaScript and Spring Boot

I started this blog as a place to share everything I have learned in the last decade. I write about modern JavaScript, Node.js, Spring Boot, core Java, RESTful APIs, and all things web development.

The newsletter is sent every week and includes early access to clear, concise, and easy-to-follow tutorials, and other stuff I think you'd enjoy! No spam ever, unsubscribe at any time.