I usually let my IDE do that for me nowadays. typing "for" brings up an autofill for all the different ways to type a for loop, it saves a trip to my browser and back. No guarantees if I could type it from memory..!
It depends on which editor you're using. for webstorm (IntelliJ), by default can type
fori: for (let i = 0; i < ; i++) { }
forin: for (const item in arr)
and forof: for (const item of array) { }
typing "for" for brings up this tooltip, I can select with arrows and press tab for it to autocomplete. if you remember which template you want, you can just type eg "fori" + tab without waiting for the tooltip to show up.
It's also similar in vscode. iirc, typing for will give you a bunch of options for the different iterators.
I usually let my IDE do that for me nowadays. typing "for" brings up an autofill for all the different ways to type a
for
loop, it saves a trip to my browser and back. No guarantees if I could type it from memory..!how do you that hehehe
It depends on which editor you're using. for webstorm (IntelliJ), by default can type
fori
:for (let i = 0; i < ; i++) { }
forin
:for (const item in arr)
for (const item of array) { }
typing "for" for brings up this tooltip, I can select with arrows and press tab for it to autocomplete. if you remember which template you want, you can just type eg "fori" + tab without waiting for the tooltip to show up.
It's also similar in vscode. iirc, typing
for
will give you a bunch of options for the different iterators.nice thanks man! awesome
your IDE will have a bunch of different ones. worth having a look wherever they're located in for other useful ones :)