I was looking into Raphael JS library but I see this:
Animation.prototype.delay = function (delay) {
var a = new Animation(this.anim, this.ms);
a.times = this.times;
a.del = +delay || 0;
return a;
};
What is the + operator before the delay variable?
Thanks.
It converts a
Stringvariable to a Number, if possible:+'21.2'equalsNumber(21.2). If the conversion fails, it returnNaN(that’s where|| 0kicks in in your example code)