Tagged Questions
6
votes
3answers
321 views
1
vote
0answers
51 views
Cleaning if / else mess in Node.js poker game
This is the third rewrite of the poker bot I am writing. The first one was such a mess of if / elses that I could not deal with ...
5
votes
6answers
85 views
Readability of JavaScript shorthand for converting strings to numbers with default value
This is perfectly readable code to me, but I'm afraid it may be too confusing to others. What do you think?
Note that I'm not interested in validation of the input here (validation will happen long ...
3
votes
3answers
214 views
Guild Wars: Knights & Dragons
I want to improve this code to make it look more professional, be loaded quicker and make it cross-browser compatible. Do note that it is not a finished site. I want to know the best practice for ...
10
votes
6answers
2k views
Can people understand my form validation code?
I've just finished creating this form validation but I want to make it public for beginner 'contact us forms'.
I was wondering if I can have some peoples' input on if they can understand/read my ...
0
votes
1answer
105 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
1answer
348 views
Improving PhoneGap/JavaScript application
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 ...
0
votes
2answers
83 views
4
votes
2answers
738 views
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
1answer
70 views
Tic-Tac-Toe JavaScript readability and additional suggestions
Requires Underscore and jQuery
I'm looking for suggestions on how to make this a little more readable and additional suggestions on flow, logic, etc.
The game can be run in a browser by just ...
3
votes
4answers
173 views
Optimizing a JavaScript snippet for portability and readability
We have an in-house time-tracking application at the office.
We, the employees, can view an overview of our hours on a web page. This web page renders a table, with worked hours per day in table ...
2
votes
1answer
253 views
Review a simple sprite sheet animation script
This is just a simple script for testing sprite sheet animations. I'm trying to improve my code style, so I'm curious about suggestions anyone might have about best practices or readability.
...
13
votes
1answer
378 views
Unit-testing function
I've got this javascript function which was written a bit ad-hoc and I'm not really sure how to go about refactoring and improving it.
It's basically an implementation of draft Unit-Testing/1.1 ...
2
votes
3answers
188 views
Should jQuery DOM Ready code be in the page with the HTML or separate JavaScript file?
I have an application with HTML, external JavaScript and a bit of jQuery on the page which is initializing specific stuff to that page. I try to keep most of the JavaScript in other files. However I'm ...
4
votes
1answer
189 views
Is this use of an array of function names and bracket-notation function calling a hacky/evil solution?
Background: I was making a chrome extension that injects movie ratings into theatres' showtimes pages. The problem I was duplicating a lot of code calling similar but just slightly different ...
4
votes
1answer
298 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:
...
1
vote
2answers
134 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 ...
3
votes
2answers
107 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:
...
1
vote
1answer
294 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 ...
4
votes
1answer
280 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
101 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
312 views
How would I format this JavaScript code so it's more readable
How can I format this code so it's more readable?
...
2
votes
1answer
207 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 ...
4
votes
4answers
220 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 ...
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
2answers
534 views
5
votes
2answers
202 views
shorthand methods
Is it good or bad practice (or, when is it appropriate) to use shorthand methods?
Lets pretend we're using jQuery here, because it has a lot of them.:
...
1
vote
2answers
838 views
Javascript querystring to object conversion
The below code converts the window.location.search querystring into a JavaScript object. In particular, if a key occurs more than once the resulting value in the object will be an array. Please feel ...
3
votes
1answer
1k views
jquery/css/html sliding panels - Please review
Is there a better way to to do what I'm doing? If not just a general review of how I did it and the usability of it (how it works and function not artistically how it looks). Working jsfiddle.
...
10
votes
4answers
896 views
Any tips on making this JS better?
Working on a personal project to keep different snippets/examples/small projects of mine organized. I want to make the most of my page width, so I decided to write a navigation menu that slides out. ...
1
vote
1answer
804 views
2
votes
1answer
874 views
How can I improve function definition and manage scope better in javascript?
I often use jQuery plugins for front-end functionality in web applications. This requires me to write code like this, where I am assigning a function to a an object property:
...
11
votes
3answers
596 views
Is this code good enough? (jQuery)
I'm working on a simple star rating system, and before I move on to actually "tallying" the votes, which I figure I'll just do with $.ajax, I wanted to make sure ...
5
votes
2answers
255 views
Feedback welcomed on this regexp tester javascript code
I'm quite new to JavaScript, and any feedback of the following code structure and syntax is warmly welcomed. It serves this little online regexp test (still a work in progress): ...