2
votes
2answers
71 views

Which for loop is more efficient in javascript? [closed]

Which one is more efficient? // < 11 for(var i = 0; i < 11; i++){ ... } or // <= 10 for(var i = 0; i <= 10; i++){ ... } I don't know exactly how the for function works but I'm ...
0
votes
0answers
39 views

store data & metadata in DOM or JS object ? which is performant?

I've a form with elements, I need to create a fieldset/sub forms with more elements for each of the main form element, dynamically based on a dropdown value. I need to take care of showing / hiding ...
0
votes
1answer
53 views

Which is the Most Efficient Way to Run a Function on a Link Click

I have so many links in my webpage. About 25 links with an id="reply_x". About 20 links with id="quote_x" and some links with id="like_x". I have written different functions using JQuery for different ...
0
votes
1answer
19 views

Cachin jquery objects simple code

I'm trying to implement caching and reduced DOM manipulation into my very complex JS code. I just want to make sure, what's more efficient? 1) var $thebox = $(".textbox[data-title*='"+dt+"']"); ...
0
votes
2answers
34 views

speed up DOM access while using $element.each()

I'm trying to make some serious delay cuts in my hefty javascript UI application. I've been reading up ways to optimize code, and from a few things that I've learnt, I understand that: ...
0
votes
0answers
69 views

Improving speed and data efficiency with javascript calculator.

I'm building a javascript calculator (with jquery mobile) for simplifying routine calculations in microscopy. I'm looking to create more efficient code and would love any input... I don't expect ...
1
vote
3answers
32 views

How can I combine two similiar javascript functions?

Is there a way to combine the following two instructions into more efficient code? $('.sandwiches').mouseleave(function () { $('.sandwiches').hide(); }); $('.food').mouseleave(function () { ...
1
vote
3answers
91 views

How can I improve or reduce redundancy of this javascript? [closed]

I'm trying to concatenate a string from certain inputs in a form, and populate another input with that string. I've included my script below, and linked to a js fiddle. I think the code inside the ...
2
votes
2answers
92 views

faster to use jquery or not to use jquery? [closed]

In desktop html5 applications I write I always use jquery although I'm writing mobile html5 applications and I'm wondering if I should use jquery at all. First, I'm curious about selectors. I have ...
1
vote
1answer
63 views

Which javascript code is more efficient when you want to search for multiple HtmlObject with a specific value?

I try to find out which javascript code is more efficient, for example when I searching several JavaScript span. this mode with jquery: $('span[value='+value+']') or this mode with standar ...
2
votes
2answers
40 views

which approach is better for implementing canvas in html5?

I want to know differences between the two following approaches from efficiency or any other point of views:(these codes are written using HTML5 Canvas) first one has separate functions including ...
0
votes
4answers
101 views

Should I avoid creating this JavaScript closure?

This may be a bit abstract but I'm trying to get my head round JavaScript closures etc. Take the following code: function MyObj() { var me = this; this.foo = function(bar) { // Do ...
5
votes
4answers
169 views

Risk of constant traffic when updating graphics using JavaScript?

I'm using JavaScript to create a basic graphic clock display on an HTML page. I'm updating digit graphics (each digit updated only when necessary) using the standard DOM mechanism: digitOne.src = ...
2
votes
3answers
136 views

JavaScript - What Level of Code Optimization can one expect?

So, I am fairly new to JavaScript coding, though not new to coding in general. When writing source code I generally have in mind the environment my code will run in (e.g. a virtual machine of some ...
5
votes
3answers
248 views

Long Loops in Node.js: Yielding Using Timers?

I'm using Node.js to loop through what could eventually be a pretty big array of posts. If I were doing something similar using client side JavaScript, I would use timers as explained here so as not ...

1 2
15 30 50 per page