In Action

Javascript Array

This is simple Javascript showing how to create an array. It is a fairly simple piece of code. The general design goal is to create a function that we can use to hold a series of arrays that can be used within our program.

Javascript in Action






Javascript Code

Javascript Code

Javascript and html code are self contained below.

 
     
<html>
<script language="javascript"> 
  function listBucket(v) {
   var rLst;
   var lst1 = ["1a","1b","1c","1d"];
   if (v === "list1") {
     rLst = lst1;
   } //end if

//code contained here is only here so you can see the output in the browser! 
  alert( rLst );
///////////////////////////////////////////////////////////////////////////
   return rLst;
  } //end function   
// end hiding -->
</script>

HTML Code

HTML Code


<form>
<input type="button" value="Run" onclick="listBucket('list1')" />
</form>
</body>
</html>