Reputation: 35
I just ran into a jQuery code example which confuses me a bit.
var $tasks = $('#task_list'), i;
This was used to get the ul element from the DOM and store it in the $tasks
variable.
But why the i
at the end?
Upvotes: 0
Views: 128
Reputation: 108500
This is exactly the same as:
var $tasks = $('#task_list');
var i;
It’s just a different syntax using commas between var
statements.
You can read more about the var
statement and peek at more advanced examples here: https://developer.mozilla.org/en-US/docs/JavaScript/Reference/Statements/var
Upvotes: 6