In JavaScript, there are several ways to check if a property exists on an object. Which one to pick pretty much depends on your use case, so you need to know how each one works.

Let’s take a look at the most commonly used methods.

  1. Checking for Truthy
  2. The in Operator
  3. hasOwnProperty()

#javascript #angular #react

How To Check if a Property Exists on a JavaScript Object
1.70 GEEK