In the Basic Algorithm Scripting: Confirm the Ending exercise, the slice() method is used to solve the problem. Here’s where I get lost with this challenge. I would never think to use the slice() method in this way because both in the FCC lesson and Mozzila web docs list parameters as the only option.
Can we replace all javascript methods’ parameters w/ any math operation?
How do you know when to code something else verses following the syntax rules?
String.prototype.slice()
SyntaxSection
str.slice(beginIndex[, endIndex])
Basic Data Structures: Copy Array Items Using slice()
FCC slice()(https://learn.freecodecamp.org/javascript-algorithms-and-data-structures/basic-data-structures/copy-array-items-using-slice)
let weatherConditions = [‘rain’, ‘snow’, ‘sleet’, ‘hail’, ‘clear’];
let todaysWeather = weatherConditions.slice(1, 3);