+3 votes
481 views
in Programming by (1.2k points)

i want to  print dynamic value by java script, now i am using this. its static 

<script>
products =["LG","SAMSUNG","LENOVO","HCL","DELL"];
for (var i=0;i<products.length;i++)
{
document.write(products[i] + "<br>");
}
</script>
this shows only these products but now when prouct is coming dynamically so how can i manage them?

1 Answer

0 votes
by Expert (5.9k points)

you can store these values in array and then print them see this :

var products = [];
for(var i=1; i<=products.length; i++) {
   arr.push(i.toString());
}

this may help you

Not a Member yet?

Ask to Folks Login

My Account

Your feedback is highly appreciated