Sorry for this late answer.
Using a temporary for this is not very convenient, it basically forces you to
create an useless variable just for this purpose.
The slice / splice solution is a little bit better, but i find it less clear,
and more error prone.
Maybe the name "last" is not the best for this functionality, and also maybe
it's not a good idea to use the same method for getting and setting (probably a
jQuery habit). Still, indexing arrays from the end seems quite common for me.
What about some simple getItem( index ) / setItem( index, item ) variation ?
More language-like and more convenient than the current solutions, they could
easily be defined with slice- and splice-compatible behaviour:
Array.prototype.getItem = function (i) {return this.slice (i, 1)[0];};
Array.prototype.setItem = function (i, v) {this.splice (index, 1, [v]);};
Regards,
Jordan Osete
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss