I’m drying to DRY up this code from the jQuery source:
cssNumber: {
"fillOpacity": true,
"fontWeight": true,
"lineHeight": true,
"opacity": true,
"orphans": true,
"widows": true,
"zIndex": true,
"zoom": true
}
I suggest the following. Can it be done better?
cssNumber: {}
"fillOpacity fontWeight lineHeight opacity orphans windows zIndex zoom"
.split(" ")
.forEach(function() {
cssNumber.name = true;
});
I’d only go for this, if you really need to save byte space. What you want to do is fill an object with values. Than you should exactly that. Which is your first code.