JavaScript是否具備相似「 range()」的方法來在提供的範圍內生成範圍?

問題:

In PHP, you can do... 在PHP中,您能夠... 函數

range(1, 3); // Array(1, 2, 3)
range("A", "C"); // Array("A", "B", "C")

That is, there is a function that lets you get a range of numbers or characters by passing the upper and lower bounds. 也就是說,有一個函數可讓您經過傳遞上下限來得到必定範圍的數字或字符。 ui

Is there anything built-in to JavaScript natively for this? 爲此,JavaScript是否內置任何內置功能? If not, how would I implement it? 若是沒有,我將如何實施? this


解決方案:

參考一: https://stackoom.com/question/GLOI/JavaScript是否具備相似-range-的方法來在提供的範圍內生成範圍
參考二: https://oldbug.net/q/GLOI/Does-JavaScript-have-a-method-like-range-to-generate-a-range-within-the-supplied-bounds
相關文章
相關標籤/搜索