javascript - Equivalent of python's range in Javascript
问题描述
I want to know what is the equivalent code for the python's range(start,stop,step=1). If anyone knows, I am really grateful for the help.
解决方案
You can try this code instead, but you need to create a function first:
var number_array = [];
function range(start,stop) {
for (i =start; i < (stop+1); i++) {
number_array.push(i);
}
return number_array;
}
推荐阅读
- algorithm - 运行 Neo4j Graph 算法 Louvain 时出现 ArrayIndexOutOfBoundsException
- vbscript - 在uft的webtable中更改子项innertext?
- php - 检查php文件中所有变量的值
- c# - 将 HTML 5 DatePicker 与日期输入字段一起使用
- html - 在 IE11 中使元素具有粘性
- javascript - 如何在路线中包含可选航段?
- javascript - 通过 $emit 选择所有复选框不会重新渲染视图 - Vuejs
- mysql - 仅显示来自每个对话的最新消息
- django - 在 django 模板标签中获取 request.path
- java - 将数据发布到服务器时出现 Android Volley 错误