javascript - Check if an array is empty or not - Postman - node.js -


i getting response in format:

{     "test1": [],     "test2": [],     "test3": [],     "test4": null,     "test5": [] } 

after sending request, response get.

and want check f. ex. test1 empty or not.

and if empty it's enough console log.

i think looking . using .length property of array

let response =   {      "test1": [],      "test2": [],      "test3": [],      "test4": null,      "test5": []  }    if(response){      if(response.test1.length == 0)      {          console.log("array empty");      }  }


Comments

Popular posts from this blog

angular - Ionic slides - dynamically add slides before and after -

minify - Minimizing css files -

Add a dynamic header in angular 2 http provider -