The LPush method

To add items to a list, we can use the LPush method; for example, the code below will insert five elements to my-list. With this method, items are inserted at the head of the list.

Get hands-on with 1400+ tech skills courses.