- The original array is not affected by this method: a new one is created instead.
This JS slice function selects elements starting at the one indexed by start argument, and finishes at (but does not include) the element indexed by the end argument:
var carArray =['Mercedes-Benz', 'BMW', 'Audi']; var modelArray = carArray.slice(0, 2);
- Simplistic design (no unnecessary information)
- High-quality courses (even the free ones)
- Variety of features
- Nanodegree programs
- Suitable for enterprises
- Paid certificates of completion
- Professional service
- Flexible timetables
- A variety of features to choose from
- Professional certificates of completion
- University-level courses
- Multiple Online degree programs
- Great user experience
- Offers quality content
- Very transparent with their pricing
- Free certificates of completion
- Focused on data science skills
- Flexible learning timetable
Even though these arguments are optional, we predict that you will be using them to specify the starting index and the end of the collection process.
|start||Whole number used to specify initial index. Negative values can be used to select from end of an array. 0 by default.|
|end||Whole number used to specify last index for extraction (not included). If omitted, all element starting with the element specified by the start parameter are going to be selected. Negative values can be used to select from end of an array.|
Note: keep in mind that the first array element will have the index of 0, not 1.
|Return Value:||A new array which contains only the selected elements|
Latest Udacity Coupon Found:
75% OFF COURSES
Udacity Black Friday Offer
The best time to save on Udacity courses is now - follow this coupon to access a 75% Udacity Black Friday discount & enjoy learning at a very low cost!