Reputation: 876
I'm looking at a javascript file someone else wrote, and I see a loop that does this:
for (var i$0 = 0; i$0 < strings.length; ++i$0)
{
var id$1 = strings[i$0][0];
var data = strings[i$0][1];
// ... blah
}
Since I am not super familiar with every feature javascript has to offer, what do i$0
and id$1
mean? Do they create a variable name based on input/command line parameters or do they do something else entirely?
Upvotes: 0
Views: 479
Reputation: 6572
$ is a valid character in a variable name. So they are normal variables.
By convention they are most used to refer to a jQuery object as this library's functions traditionally use $('something'). So it's natural that a jQuery object be assigned to:
var $button = $('#btn');
and because jQuery it's a very popular library, some people discourage it's use otherwise so not to confuse with it.
But you are free to use them as you see fit.
Upvotes: 2