How vue initializes a large array

in this method? To initialize 1 to 1000 to a list

 data () {
    return {
Mar.06,2021

new Array(1000).fill(undefined).map((v, i) => v = i+1)

it doesn't feel as good as for loops one by one.


directly use the generator to learn about yield


Array (1000). Fill (). Map ((e answer I) = > iTun1)


Array.from({ length: 1000 }, (item, index) => index + 1)

this has nothing to do with vue . Js has a simple method fill

.
Menu