Say I have a fairly hefty JavaScript file, packed down to roughly 100kb or so. By file I mean it’s an external file that would be linked in via <script src="...">, not pasted into the HTML itself.  Where’s the best place to put th...
Are these two functions doing the same thing behind the scenes? (in single statement functions)  var evaluate = function(string) {     return eval('(' + string + ')'); }  var func = function(string) {     return (new Function( '...
Is there a reliable cross-browser way to detect that a tab has focus.  The scenario is that we have an application that polls regularly for stock prices, and if the page doesn't have focus we could stop the polling and save everyone the traffic...
I've heard this quite a few times. Are JavaScript loops really faster when counting backward? If so, why? I've seen a few test suite examples showing that reversed loops are quicker, but I can't find any explanation as to why!  I'm...
I've recently read the Yahoo manifesto Best Practices for Speeding Up Your Web Site. They recommend to put the JavaScript inclusion at the bottom of the HTML code when we can.  But where exactly and when?  Should we put it before closing </h...
I was browsing Google Code when I chanced upon this project called JSpeed - optimization for Javascript.  I noticed one of the optimization was to change i++ to ++i in for loop statements.  Before Optimization  for (i=0;i<1;i++) {}  for (var i =...
I've been wondering, is there a performance difference between using named functions and anonymous functions in Javascript?   for (var i = 0; i < 1000; ++i) {     myObjects[i].onMyEvent = function() {         // do something     }; }   vs  f...
I've always had to put null in the else conditions that don't have anything. Is there anyway around it? E.g.  condition ? x = true : null;   basically, is there a way to do:  condition ? x = true;   Now it shows up as a syntax error  FYI, h...
Which is better?   I'm asking this just for the sake of shaving a few bytes, as I can use +x instead of number(x). Does parsefloat do something better?...
I've just written my first google apps scripts, ported from VBA, which formats a column of customer order information (thanks to you all of your direction).  Description:   The code identifies state codes by their - prefix, then combines the fo...

Tags

Recent Questions

Top Questions

Home Tags Terms of Service Privacy Policy DMCA Contact Us

©2020 All rights reserved.