JavaScript Notes:

 

I have kept these notes as I go through JavaScript and decided to post them because it may answer some questions.

 

var thename="Smith/John";

var thelen = thename.length;

 

thename.charAt(5) will return the / (note that countin starts at 0)

thename.indexOf('/') will return 5

thename.substring(6,9) will return John

thename.toUpperCase will return SMITH/JOHN

thename.toLowerCase will return smith/john

 

var schedule = newArray("CIS17", "CIS44", "ENG11", "MTH31");

var schedule = newArray(5);

var schedule = ["CIS53", "CIS31", "HST21"]

schedule.sort(); elements become string and are sorted

var rslt = schedule.join(" / "); means that the courses in the schedule are strung together with a / between them and stored in rslt.

schedule.concat() will add elements to the array

var partschedule = schedule.slice(1,2) will take out starting with element 1 through element2 (first element in array is element0)

There are others.