JSFiddle - React, Tailwind, and code Playground

by akang2

JavaScript

//Arrays

var cars=new Array('chevy','ford','dodge','honda');

var animals=new Array('lion','panda','crane','viper');

var bothCombined=cars.concat(animals);

document.write('This is combined  ' +bothCombined +'<br /><br />');

document.write('This is alone ' +cars+ ' <br /> <br />');

document.write(animals.push('dragon')+' is the # of elements in the animals array now');

document.write('<br /><br />' +cars.shift());

document.write('<br />' +animals.reverse()+ '<br /><br />');

//create the array but don't give it any values
var whatever=new Array(5);

//create the loop, use the prompt to assign whatever the user inputs to the array
for(count=0;count<5;count++){
    whatever[count]=prompt('pick a card','put it here');
}

document.write(whatever.toString() +'<br /><br />');

document.write(whatever[3]);