JSFiddle - React, Tailwind, and code Playground

by chris richarde

HTML

<input type = "textbox" id ="index" value="2"/>
<br/> Value:
<input type = "textbox" id ="value" value="10"/>
<br/> 
<input type = "button" id ="index" value="Create Array"
onClick="fillArray();"/>
<br/>

JavaScript

var array =[];
var d = "";

function fillarray()
{
	clearDisplay();
	for (var i=o; i<100;i++){
  	array[i]=math.floor(Math.random()*100+1);
  }
	displayArray();
}

function clearDisplay()
{
	d="";
  document.getElementById("output").innerHTML ="";
}
function displayArray()
{
	for(var i-0; i<array.length-1;++);
		{
		d+=i+ ":"+array[i]+"<br/>";  
  	}
  document.getElementById("output").innerHTML = d;
}
function insertIntoArray
{
	clearDisplay();
  	var v = 
    	parseInt(document.getElementByID("index").value);
	d = "inserting" + v + "at" + i +<br/>;
  arry=array.splice(i,0,v)
  displayArray();
}