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

Содержание

Слайд 2

JavaScript Array Object An array is a special variable, which

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";

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.

Join two arrays-concat()

Click the button to join two arrays.


onclick="myFunction()"> Try It

Слайд 5

Click the button to join three arrays. Try It function

Click the button to join three arrays.




Join three arrays-concat()

Слайд 6

Click the button to join the array elements into a

Click the button to join the array elements into

a string.




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

Слайд 7

Click the button to remove the last array element. Try

Click the button to remove the last array element.


it

Remove the last element of an array- pop()

Слайд 8

Click the button to add a new element to the

Click the button to add a new element to

the array.




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

Слайд 9

Click the button to remove the first element of the

Click the button to remove the first element of the

array.




Remove the first element of an array- shift()

Слайд 10

Click the button to add elements to the array. Try

Click the button to add elements to the array.


it

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

Слайд 11

Click the button to reverse the order of the elements

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

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. Try it function

Click the button to sort the array.




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

Слайд 14

Click the button to sort the array. Try it function

Click the button to sort the array.




Sort numbers (numerically and ascending) - sort()

Слайд 15

Click the button to sort the array. Try it function

Click the button to sort the array.




Sort numbers (numerically and descending) - sort()

Слайд 16

Click the button to add elements to the array. Try

Click the button to add elements to the array.


it

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

Слайд 17

Click the button to convert the array into a String.

Click the button to convert the array into a String.


onclick="myFunction()">Try it

Convert an array to a string - toString()

Слайд 18

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