Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialbrandonlind2
7,823 Pointscan someone explain these []?
I'm seeing alot of square brackets within functions parentheses on mdn, but I'm not sure what they mean? for example
array.splice(start, deleteCount[, item1[, item2[, ...]]])
1 Answer
Steven Parker
230,879 PointsAs used in documentation, they mean "optional". So for your example:
array.splice(start, deleteCount[, item1[, item2[, ...]]])
This shows that the splice method can take as few as 2 arguments (start and deleteCount), but it can take more (items to be added), with no obvious limit.
brandonlind2
7,823 Pointsbrandonlind2
7,823 PointsThanks man!