3 ms·
That's not really a huge improvement over just making a sparse array though, is it? Looks more confusing to me. Could be wrong but I'm pretty sure e.g. Array(10
by jchw 3y ago
That's not really a huge improvement over just making a sparse array though, is it? Looks more confusing to me. Could be wrong but I'm pretty sure e.g. Array(1000000000) does not actually allocate much.
- arve0 3y agoI'm not up to speed in JSX, how is it be better there? Don't one normally map over an array to loop? You cannot use for-loops inside JSX? Or do you create an array of JSX-elements, like let elements=[] for (let i=0; i < 10; i++) { elements.push(<li key={i}>I'm number {i}</li>) } return <ol>{elements}</ol>; Does not seem like an improvement to me.
- jchw 3y agoIt's just JS: You can do that, or you can use any helper method, or write your own helper. Can't really do that in Svelte.