Various JavaScript Programming Notes

To make a 2 dimensional array

var v=new Array();
var v2=new Array();
v[0]=1; v[1]=7; v2[0]=v;
var x = v2[0][0] // x is 1;

Add to an array

v[v.length]=9;

Function – If string S is in array A, then return true

function inArray(string, array){
 for(var i = 0;i < array.length;i++){
 if (array[i]==string){
 return true;
 }
 }
 return false;
}