Here's the code I want to simplify further if possible (I got a whole list of ifs but this should give you a general idea of what I want):
function doc(type, name) {
if (type === 'getid')return document.getElementById(name);
if (type === 'getclass')return document.getElementsByClassName(name);
}
Aucun commentaire:
Enregistrer un commentaire