-1

I have the following JSON object that is passed to one of my functions …

{"action":"setProjectAll", "application":{"proId":"new","zoomPosition":35,"scrollerPosition":0,"language":"en","timelinePosition":0}, "clips":[]}

How can I test this object for the propertie "clip" to be "[]" (empty)? Right now in the example above it is empty, however since the object is dynamic I need to test for that property if it contains values or not.

How can that be done? thank you

matt
  • 42,713
  • 103
  • 264
  • 397

1 Answers1

2

How about

if (x.clips && x.clips.length === 0)
Thilo
  • 257,207
  • 101
  • 511
  • 656