Skip to main content
Improved the formatting.
Source Link
vatsal
  • 4k
  • 2
  • 22
  • 19

If you are using underscore.js library then object/array operations become simple.

In your case _.has method can be used. Example:

yourArray = {age: "10"}

_.has(yourArray, "age")

yourArray = {age: "10"}

_.has(yourArray, "age")

returns true

But,

_.has(yourArray, "invalidKey")

_.has(yourArray, "invalidKey")

returns false

If you are using underscore.js library then object/array operations become simple.

In your case _.has method can be used. Example:

yourArray = {age: "10"}

_.has(yourArray, "age")

returns true

But,

_.has(yourArray, "invalidKey")

returns false

If you are using underscore.js library then object/array operations become simple.

In your case _.has method can be used. Example:

yourArray = {age: "10"}

_.has(yourArray, "age")

returns true

But,

_.has(yourArray, "invalidKey")

returns false

Source Link
vatsal
  • 4k
  • 2
  • 22
  • 19

If you are using underscore.js library then object/array operations become simple.

In your case _.has method can be used. Example:

yourArray = {age: "10"}

_.has(yourArray, "age")

returns true

But,

_.has(yourArray, "invalidKey")

returns false