codeburst

Bursts of code to power through your day. Web Development articles, tutorials, and news.

Follow publication

Four More Powerful JavaScript Operators You’ve Never Heard Of

Anthony Jimenez
codeburst
Published in
4 min readNov 25, 2020

--

Let’s learn under utilized operators!

JavaScript is incredibly difficult to master. This is partly because JavaScript is a vast language with features that even seasoned developers may not fully understand. In a previous article, I highlighted four operators that you’ve probably never heard of. Let’s continue to strengthen our JavaScript skills by learning about four more underutilized operators.

The operators in this article can easily be used together to implement powerful solutions to common problems. We will prove this by continuously building and expanding on the same function. Stick around to see how seamlessly they work together. Let’s dive in!

  1. delete

The delete operator removes a property from an object. If the deletion was successful it returns true, otherwise it returns false. While this seems straightforward, delete has many edge cases that make its behavior tricky. For example, if you try to delete a property that doesn’t exist, delete will have no effect yet return true.

All primitive types and functions declared with let, var, and const cannot be deleted. However, variables that were not declared with let, var, or const can be deleted.

It’s usually a really bad idea to create variables without declaring them properly. Moving forward, we will assume that all primitive types have been properly declared and are not delete-able. Unlike functions, methods can be deleted off of objects.

--

--

Published in codeburst

Bursts of code to power through your day. Web Development articles, tutorials, and news.

Written by Anthony Jimenez

Web Developer with a passion for JavaScript.

Responses (2)

Write a response