Reputation: 173
I came across this snippet, and it seems quite unconventional to me, can anyone help me explain what's the purpose of it? Thanks in advance.
image.onload = image.onerror = function () {
entry[name] =
image =
image.onload =
image.onerror = null;
delete entry[name];
};
Upvotes: 1
Views: 65
Reputation: 5964
You can interpret that as:
when image loads or has an error, remove any other events tied to the image and also delete
entry[name]
.
You can "chain" properties so that they all have the same value:
this.name = 'bob';
this.age = '21';
this.name = this.age = null; /* <<---Both properties are now null*/
Upvotes: 1