JavaScript. Lesson 6 презентация

Содержание

Слайд 2

JavaScript Array Object

An array is a special variable, which can hold more than one value

at a time. An array can hold many values under a single name, and you can access the values by referring to an index number.

Слайд 3

Create an Array

1: Regular:
var myCars=new Array();  myCars[0]="Saab";        myCars[1]="Volvo"; myCars[2]="BMW";
2: Condensed:
var myCars=new Array("Saab","Volvo","BMW");
3: Literal:
var myCars=["Saab","Volvo","BMW"];

An array

can be created in three ways.

Слайд 4

Join two arrays-concat()

Click the button to join two arrays.


It

Слайд 5

Click the button to join three arrays.




Join three arrays-concat()

Слайд 6

Click the button to join the array elements into a string.


onclick="myFunction()">Try it

Join all elements of an array into a string-join()

Слайд 7

Click the button to remove the last array element.




Remove the last element of an array- pop()

Слайд 8

Click the button to add a new element to the array.


onclick="myFunction()">Try it

Add new elements to the end of an array-push()

Слайд 9

Click the button to remove the first element of the array.


it

Remove the first element of an array- shift()

Слайд 10

Click the button to add elements to the array.




Add new elements to the beginning of an array - unshift()

Слайд 11

Click the button to reverse the order of the elements in the

array.




Reverse the order of the elements in an array – reverse()

Слайд 12

Click the button to extract the second and the third elements from

the array.




Select elements from an array – slice()

Слайд 13

Click the button to sort the array.




Sort an array (alphabetically and ascending) – sort()

Слайд 14

Click the button to sort the array.




Sort numbers (numerically and ascending) - sort()

Слайд 15

Click the button to sort the array.




Sort numbers (numerically and descending) - sort()

Слайд 16

Click the button to add elements to the array.




Add an element to position 2 in an array - splice()

Слайд 17

Click the button to convert the array into a String.




Convert an array to a string - toString()

Имя файла: JavaScript.-Lesson-6.pptx
Количество просмотров: 43
Количество скачиваний: 0