Checking if a key exists in a JavaScript object?
Asked 07 September, 2021
Viewed 3K times
  • 59
Votes

How do I check if a particular key exists in a JavaScript object or array?

If a key doesn't exist, and I try to access it, will it return false? Or throw an error?

25 Answer