I’m trying to loop through a variable in JQuery and reassign the value of this in the following Coffeescript.
$.each data.rows, ->
completion_time = [this[0], new Date(new Date('Jan 01 2000').getTime() + this[1])]
this = completion_time
However this produces the following error message:
SyntaxError: reserved word “this” can’t be assigned
On each iteration the value of this looks something like this:
[“abc123”, 12302103, 1230132, 1230123]
What I’m trying to do is reassign it to the value of:
[“abc123”, 12302103]
I tried assigning this.value as well, no dice. Any suggestions?
You can’t reassign
this. You can modifythisto contain the elements in the new arrayI can’t stand CoffeScript, so I’ll just show it in JS