Consider these 2 statements, which identically detect an iPod or iPhone:
if (/ip(hone|od)/i.test(navigator.userAgent))
if (/iphone|ipod/i.test(navigator.userAgent))
Which would you use? I argue for the second, as it is simple, clear, easy for maintainers to quickly grok. I think simplicity is more important.
My colleague argues for the purity and elegance of the first solution. He thinks purity/elegance is most important.
Anyone have an opinion on this?