0

I have an array of objects like This:

 Data =  [
     {
       "email": "abc@gmail.com"
     },
     {
       "email":["cde@gmail.com","fgh@gmail.com"]
     },
     {
       "email":"cde@gmail.com"
     }
    ]

I want to print all those emails:

for (let i = 0; i < Data.email.length; i++) {
    console.log(Data.email[i]);
  }

but I want to use for loop only when email is array, How can I find that email property is array or not? so that I can loop

doran
  • 1

0 Answers0