3
votes
1answer
280 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 = ({ ...
1
vote
2answers
95 views

What could I have done better with this code from a calendar?

I was writing a calendar a long time ago and, coming back to the code, I've realized that it's not the best. I was fairly mediocre at programming back then. I'm using jQuery, Mousetrap, and ...
0
votes
0answers
47 views

Optimizing Jquery Twitch TV Application

I'm trying to get in the habit of writing better looking code and more efficient code blocks. I wrote this Twitch TV Application which allows you to add and edit channels and it lets you know when a ...
3
votes
2answers
77 views

If statement, is the shortened version readable enough?

I have to perform an IF statement in my Javascript code. I utilised the first method shown below: (someVar1 !== "someString") && (someVar2[i].disabled = (someVar3.find("." + someVar4).length ...
2
votes
0answers
362 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 ...
4
votes
1answer
140 views

Loading Javascript Libraries with PHP API

First question on this site so please take it easy on me and let me know if I infringe the common etiquette :-) I have written the following script which simply: Loops through javascript files ...
1
vote
1answer
85 views

Familiar with dynamic languages, new to JavaScript: criticize my style

Preamble I am trying to learn JavaScript by writing code and looking up documentation, one problem at a time. I am already familiar with several "dynamic" languages, so I'm hoping to be productive ...
2
votes
4answers
129 views

How would I format this JavaScript code so it's more readable

How can I format this code so it's more readable? $(".card").click(function(){ $(this).stop().animate({ width:'0px', marginLeft: margin+'px', opacity: ...
0
votes
1answer
55 views

A request for general commentary on my first JSFiddle [closed]

This is my first attempt at building a functional (and functioning) website. Thankfully, everything (or everything important) is working as it should, but I know the code is rife with redundancy and ...
2
votes
1answer
156 views

New at jQuery, lack of structure

My job required me to learn jQuery the last couple of weeks, but it's a mess and I do not know how to structure my code in an acceptable manner. I come from a Java and PHP background and have never ...
1
vote
0answers
224 views

Could this JavaScript / PhoneGap code be improved to use module, or other, pattern for better readability and maintainbility?

I have a PhoneGap application that I wrote some time ago. After looking Doug Crockford's video seminar JavaScript: The Good Parts (http://www.youtube.com/watch?v=hQVTIJBZook) I was just wondering if ...
4
votes
4answers
202 views

poh-tay-toh poh-tah-toh, does writing the same code a different way affect readability?

I have a particular if statement that could be written in different ways, and I'm curious as to whether there's any significant difference in readability that I should prefer one over the other: The ...
1
vote
1answer
185 views

Snippet of custom array.indexOf that supports nested arrays

I recently wrote a snippet to make a custom array.indexOf but with nested array support in addition to allow using a nested array as needle. For example, it correctly returns the index 3 in this ...
4
votes
1answer
2k views

Pie Chart jQuery-UI plugin

I would greatly appreciate the input of any gurus out there. I have recently begun learning JavaScript and then jQuery and jQuery-UI and have thought I would take a stab at writing my own jQuery-UI ...
2
votes
3answers
447 views

Building an HTML table using JavaScript

More readable way to do this? renderHtmlTable(function(tableItems) { var tableArray,_i,item,_len; tableArray = ['<table id = sampleTable ><thead><tr>' + ...

1 2
15 30 50 per page