I'm looking for some ways to optimize my projects, both in performance and in practicality and speed, and I came across the following question, what is the most appropriate way to delegate some values without losing too much performance? using function? objects?
e.g:
Objects
var z = {
fec: 'firstElementChild',
nx: 'nextElementSibling',
pr: 'previuousElementSibling',
cl: 'className',
ci: 'clientInformation',
qs: 'querySelector',
qsa: 'querySelectorAll'
}
document[z.qs]('h3');
Functions
function qs(el) {
return document.querySelector(el);
}
qs('p');