5
votes
1answer
322 views

Optimizing and consolidating a big jQuery function

I understand this is a very vague question and a lot of code to look over. My question is basically: I have all these functions that work together to create functionality on a page: is the structure ...
4
votes
2answers
79 views

Font size resizable

Good morning, I started programming 5 months ago. I created a function to calculate the font size to fit the width of the website I'm doing. I believe the code is a bit ugly and could use some ...
3
votes
2answers
259 views

indexOf() + 1 vs indexOf() != -1

When checking for existence of a substring I have been doing this: var that = "ok hello cool"; if( that.indexOf('hello') + 1 ) { } Instead of: if( that.indexOf('hello') != -1 ) { } Am I ...
3
votes
1answer
259 views

Which is better: the short, clever way, or the long, ctrl+c way?

The code below is equivalent. I can see pros and cons for both versions. Which one is better? Short version: character.on("key",function(key){ var action = ({ ...
3
votes
1answer
66 views

function to generate values of a javascript object

The following code works but I am wondering if it can be improved both readability and performance. I am using jquery and underscore. Any suggestions, comments or feedbacks will be appreciate. thanks. ...
3
votes
2answers
219 views

Most elegant image to image frame comparison algorithm

I'm interested in finding the most elegant and 'correct' solution to this problem. I'm new to JS/PHP and I'm really excited to be working with it. The goal is to compare the size of a given image to ...
3
votes
1answer
192 views

Making a good code structure

What do you say about the code structure below? This is one of the recommended ways of writing JS code in my education. What is the pros and cons with writing code this way? Can you recommend any ...
3
votes
1answer
94 views

The eternal dilemma: bar.foo() or foo(bar)?

I was using foo(bar) as it's adopted for functional programming. console.log( join( map(function(row){ return row.join(" "); }, tablify( ...
3
votes
1answer
107 views

Column selection and URL modification

I have an HTML table representing a database table and a sidebar which holds different anchors ready to perform CRUD operations on click. Because the hrefs in the anchors aren't in general valid for ...
3
votes
2answers
179 views

jQuery Object Oriented Plugin

Update: Great answers up to now, but I would still love to have a bit of review about possibility of variable caching and the filter I'm using for rows and page sets! After seeing a lot of ...
2
votes
3answers
251 views

JavaScript code cleanup

As this community is full of experienced JavaScript developers, and I'm a newbie in JavaScript, I would like if some of you could look over my code for a website I'm building (personal portfolio) and ...
2
votes
0answers
354 views

Knockout.js: how to enhance the readability of Javascript part

There is no doubt that Knockout.js is a very useful tool, which will save you from a lot of Javascript(Jquery) binding hassle, which will reduce your team's bug ratio concerning this part. But ...
1
vote
3answers
87 views

Improving Javascript code of a failed test

I just failed in a JavaScript test and I would really appreciate some comments of how I can improve so I can keep learning. The test was about making a form interactive, where the code should do ...
1
vote
1answer
115 views

Code to manage weekdays and hours

I have the following code: 1) the html part consist of two container. Both containers have a list of hour and day weeks 2) a javascript code which is used to manage these lists of inputs. I ...
1
vote
2answers
96 views

getTweets in JavaScript

I'm a JavaScript newbie who was first introduced to JavaScript by jQuery. I'm trying to switch over some of the small things I've written in jQuery to JavaScript as a way of learning. I was wondering ...

1 2
15 30 50 per page