JQuery Array Create

From CoderLearner
Jump to: navigation, search

jQuery Create Array

Create array in jQuery is the same as in JavaScript.

Syntax

Create array.

var myList =[1,5,6,23,53];

Example 1

Access array element.

$(document).ready(function() {
	var myList =[1,5,6,23,53];
	alert(myList[0]);
});

Output

1

Example 2

Access array elements.

	
$(document).ready(function() {
	var myList2 =['girl','boy','fist'];
	alert(myList2[0]);
});

Output

girl