JavaScript for Beginners #32 Basic Array Methods & Properties | push() | unshift() | pop() | shift()

preview_player
Показать описание

0:00 Introduction
0:20 Setting up an array
0:46 Getting the first item of an array
1:23 Getting the last item of an array
1:53 Using the length property
2:30 Getting the last item of an array using the length property
3:26 Push method to add items to the end of an array
4:55 Pushing multiple items to the end of an array
6:15 Unshift method to add items to the beginning of an array
7:32 pop method to remove items from the end of an array
9:52 shift method to remove items from the beginning of an array
10:36 creating a music playlist function
14:06 updating our music playlist function

JavaScript Playlist:

MDN Arrays:

MDN Length Property:

MDN Push Method:

MDN Unshift Method:

MDN Shift Method:

MDN Pop Method:

NodeJS:

VS Code:
Рекомендации по теме
Комментарии
Автор

The thing that seems strange to me is that the playlist gets modified by separate function calls, even though we are not returning the new list, just the items. We never said updatedPlaylist = getSong(playlist) and then called the method again with updatedPlaylist = getSong(updatedPlaylist)

laponiec