You should use an array:
function createVariables(){
var accounts = [];
for (var i = 0; i <= 20; ++i) {
accounts[i] = "whatever";
}
return accounts;
}
You then have access to accounts[0]
through accounts[20]
.
More Related Contents:
- what all the main differences in cordova and phonegap [closed]
- contenteditable change events
- No visible cause for “Unexpected token ILLEGAL”
- Set keyboard caret position in html textbox
- No ‘Access-Control-Allow-Origin’ header is present on the requested resource. Origin ‘…’ is therefore not allowed access
- How do I include a JavaScript script file in Angular and call a function from that script?
- How should I call 3 functions in order to execute them one after the other?
- How to copy static files to build directory with Webpack?
- How to get evaluated attributes inside a custom directive
- How to Use Sockets in JavaScript\HTML? [closed]
- How can d3.transform be used in d3 v4?
- $ is not a function – jQuery error
- Get variable name. javascript “reflection”
- Execute function before refresh
- Why does $(‘#id’) return true if id doesn’t exist?
- How can I count the number of elements with same class?
- css position absolute making the textbox go down
- Using RequireJS, how do I pass in global objects or singletons around?
- JavaScript TypeError: Cannot read property ‘style’ of null
- Save to Local File from Blob
- Why does sorting a JS array of numbers with < work?
- How to check for broken images in React JS
- How do I install the babel-polyfill library?
- Is there a C#-like lambda syntax in JavaScript?
- using await on global scope without async keyword
- JavaScript NTP time
- What are the different ways of writing an IIFE? What are their use cases?
- Google Directions Api returning 0 routes
- What is the difference between Event.target, Event.toElement and Event.srcElement?
- HTML5 Canvas: Get Event when drawing is finished