javascript - Print one array element into another array -
i trying print 1 list of array element array element following code:
<html> <body> <p id="demo"></p> <p id="demo1"></p> <script> var juice = []; var fruits = [2, 5, 7, 10,15, 25,28,34,38,45,49,52,55,57,59]; for(int =0;i < fruits.length;i++){ juice[i] = fruits[i]; } document.getelementbyid("demo").innerhtml = juice.length; document.getelementbyid("demo1").innerhtml = juice; </script> </body> </html>
i not getting output above code.
this work you.
<body> <p id="demo"></p> <p id="demo1"></p> <script> var juice = []; var fruits = [2, 5, 7, 10,15, 25,28,34,38,45,49,52,55,57,59]; for(var =0;i < fruits.length;i++){ juice[i] = fruits[i]; } document.getelementbyid("demo").innerhtml = juice.length; document.getelementbyid("demo1").innerhtml = juice; </script> </body> </html>
Comments
Post a Comment