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

Popular posts from this blog

Load Balancing in Bluemix using custom domain and DNS SRV records -

oracle - pls-00402 alias required in select list of cursor to avoid duplicate column names -

python - Consider setting $PYTHONHOME to <prefix>[:<exec_prefix>] error -