Hey there! any question in your mind? Ask It Now!.

Popular Categories





print dynamic value by java script

+3 votes
98 views
asked in Programming by jazs (1,220 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
answered by duke Expert (5,813 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

Related Questions

+2 votes
1 answer 282 views
+6 votes
1 answer 2,895 views
+2 votes
3 answers 359 views
+1 vote
1 answer 195 views
–1 vote
0 answers 192 views
+2 votes
1 answer 1,280 views
+2 votes
1 answer 221 views
0 votes
0 answers 114 views
+2 votes
1 answer 201 views

Not a Member yet?

Ask to Folks Login

My Account
254 Folks are online
0 members and 254 guest online
Your feedback is highly appreciated