JS_101_1

var setAttribute = "setAttribute";
var elem = document.body;
elem[setAttribute]("width", 120);

instead of

HTMLElement.prototype.setAttr = function(prop,val) {
this.setAttribute(prop,val);
}
document.body.setAttr('width','300');

I think…?

Post a Comment

You must be logged in to post a comment.