context: I’m building a favouriting
system that uses html localstorage
API (with a php session fallback). If a favourited item is on the
page, add the class ‘favourite’ with js…
If I don’t know whether the elements id will be present on the page. Is it better to check whether it exists first, or will jQuery return false just as efficiently?
There is test code for a similar situation on jsperf.
VS