Tag Archives: for loop

Create a JavaScript array and loop through it

Create a JavaScript array and loop through it: var theBeatles = [ “John Lennon”, “Paul McCartney”, “George Harrison”, “Ringo Starr” ]; for (i = 0; i < theBeatles.length; i++) { $(‘#myDiv’).append(theBeatles[i]+’ ‘); }

Posted in JavsScript, jQuery | Tagged , , , , | Comments Off on Create a JavaScript array and loop through it