1
00:00:00,090 --> 00:00:04,800
Displace method can be used to add multiple new items to an array.

2
00:00:04,800 --> 00:00:11,190
This method also allows us to specify the position of the new element and also if any elements should

3
00:00:11,190 --> 00:00:19,250
be removed let's go through an example to better illustrate this concept see we wanted to add two fruits

4
00:00:19,550 --> 00:00:20,850
lemon and banana.

5
00:00:20,900 --> 00:00:31,860
After the second element in our array which is orange to do this we can type the following.

6
00:00:32,220 --> 00:00:33,720
We start with the variable name

7
00:00:38,640 --> 00:00:40,720
and then we create our splice method.

8
00:00:56,390 --> 00:01:04,270
The value 2 indicates that we want the new elements to start with an index number of 2 the 0 indicates

9
00:01:04,270 --> 00:01:07,900
that we do not want to remove any of the other elements in our array

10
00:01:11,190 --> 00:01:15,080
once we save our file and previewed in our web browser

11
00:01:19,350 --> 00:01:30,140
we can see that lemon and banana have been added after orange lemon does have an index value of 2 so

12
00:01:30,140 --> 00:01:31,400
the output is correct.
