I'd like to point out that if jQuery fell back to the fundamental Array.prototype.forEach function when available, $.each would be /much/ faster than a for loop. Array.prototype.forEach, when available, is native code.
No. forEach() being native doesn't prevent it from generally being slower than a foor loop, because it still has to do a function call on every iteration.
Front End Development Guidelines
41–50 of 51 posts
Re: Front End Development Guidelines
#42"Javascript code requires regular commenting in order to make it easily understandable." Or you could, you know, just make code that's understandable. I'm such an Internet jerk.
I usually aim to make code that solves the problem it was intended to solve, as elegantly as possible. (Where elegance correlates closely to efficiency.) Whether it's understandable or not is completely secondary. Often this means that if I don't leave myself a reasonable comment about what I'm doing in that spot and why, I'll relearn the importance of good comments later.
Re: Front End Development Guidelines
#43Re: Front End Development Guidelines
#44Earlier quoted context omitted.
I think the idea is that if you use single quotes for strings, you don't have to escape the double quotes that are often found in html. ' something ' But the same goes for something like "you can't do that" I guess it just depends what you don't want to escape. For Google, the more probable scenario was probably the former.
The former isn't a very good reason: HTML/XML accept both double and single quotes, so " something " would work equally well.
Re: Front End Development Guidelines
#45Re: Front End Development Guidelines
#46This looks good - however some of the language used is a bit interesting. I laughed when I read "chain like a sick bitch" but I believe most people (especially young kids, who will benefit from this the most) may see it as a bit aggressive / over the top.
Re: Front End Development Guidelines
#47Kind of surprised that there's no love for sass/scss here. Scss has made producing css a delight and v3.1 was just released which is great. Any front end developer who hasn't given it a shot should try it at least once.
Re: Front End Development Guidelines
#48Nice guide & nicely written! This example snippet actually generates a Javascript error (at least, in IE9): var foo = null; // foo is null, but bar is undefined as it has not been declared if (foo == null && bar == null) { // still got in here } It will work if bar is declared but has value undefined , but not if bar is completely undeclared as shown.
typeof bar === 'undefined'Re: Front End Development Guidelines
#49I remember awhile back another post kinda like this where it was a companies new front end dev training material. Anyone remember that or have a link? I've been trying to find it.
Re: Front End Development Guidelines
#50I remember awhile back another post kinda like this where it was a companies new front end dev training material. Anyone remember that or have a link? I've been trying to find it.
Not sure if this is what you're looking for, but it covers very similar material http://na.isobar.com/standards/