Author name: Artturi Jalli

What Is “javascript:void(0)”—A Full Guide (+Examples)

You may have encountered javascript:void(0) in an HTML document as a href attribute like this: A common reason why developers use javascript:void(0) trick is to prevent the page from reloading when clicking a link. This comprehensive guide teaches you: Speaking of examples, I think the best way to learn what javascript:void(0) does is by taking …

What Is “javascript:void(0)”—A Full Guide (+Examples) Read More »

JavaScript How to Find Duplicates in an Array (without Removing)

To find (and not delete) duplicates in a JavaScript array, you can use this function: Example use: Output: To learn how the above approach works, and what alternatives exist, please keep on reading. This guide shows you ways to find array duplicates and show them instead of deleting them. Besides, you will learn what performance …

JavaScript How to Find Duplicates in an Array (without Removing) Read More »

JavaScript ‘throw new Error’ vs ‘throw Error’ vs ‘throw something’

In JavaScript the difference between throw Error and throw new Error is that: When it comes to behavior, there’s really no difference between throw Error and throw new Error. For example: But the more technically correct way to throw a new Error object is by using the throw new Error instead of throw Error. Also, …

JavaScript ‘throw new Error’ vs ‘throw Error’ vs ‘throw something’ Read More »

Scroll to Top