Jaccs Jaccs -4 years ago 419
Javascript Question

How to use forEach in vueJs?

I have a response like below from an API call,

response

Now, I have to repeat the whole arrays inside the arrays. How do I do that in VueJS?

I have searched for using forEach.. nowhere I found forEach usage like key|value pair.

Can anyone help me on how to fetch the values from that arrays by using either forEach or any else(VueJS)?

Thanks & Regards,

Answer Source

In VueJS you can use forEach like below.

let list=[];
$$.each(response.data.message, function(value, key) {
     list.push(key);
   });

So, now you can have all arrays into list . use for loop to get values or keys

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download