如何仅传递第二个参数的值,而函数在JS中具有三个参数?
function range(start=0,end,step=1) {
}
console.log(range(10));
在这里,我希望10作为“端”值。 “启动”和“步骤”的默认值为0和1。
function range(start=0,end,step=1) {
}
console.log(range(10));
Here I want 10 as the "end" value. Default values of "start" and "step" are 0 and 1.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
为
未定义的
(从字面上看)值为默认值。A default value is taken for
undefined
(literally) value.我找到了两种做到这一点的方法,
第二种方法更容易自定义
I found two ways to do it
the second one is easier to custom