7 votes

Hangman learning AI

Here are a few general feedbacks: Have a coherent code style You're mixing multiple code styles sometimes you put spaces around operators ng-show='step == 0', ...
Volune's user avatar
  • 171
6 votes

Baseball player statistics controller

Bearing in mind that you claim that you do not to maintain this code anymore1, there are a few suggestions I would have about this code: define functions and accept parameters- that should allow the ...
Sᴀᴍ Onᴇᴌᴀ's user avatar
5 votes
Accepted

Summarize JS Array more efficiently

I am also using MomentJS for formatting dates. I have experienced performance issues when using MomentJS before. It's not because it's terrible but rather the opposite. It just does a lot of things ...
Joseph's user avatar
  • 25k
4 votes

Ionic REST + Authentication

The code looks pretty good to me. I am rather new to AngularJS myself, but I did some a spot where you could get rid of some redundancy in your ...
Malachi's user avatar
  • 28.6k
4 votes
Accepted

Partitioning an array of objects into four arrays by one attribute

This can easily be done with array.reduce ...
Joseph's user avatar
  • 25k
4 votes
Accepted

Beginner's Calculator code

Alright - A couple of things: Your calcService is redundant. The mathService is just fine. Try to avoid ...
Nilzone-'s user avatar
  • 1,426
4 votes

BlackJack in Angular

Yes, I agree that the code style is not great and there are several design issues here as well. For example, why does the main game object have a shuffle() function?...
Carl Tashian's user avatar
4 votes
Accepted

javascript - create an object containing objects based on JSON data

You could dry up this code by adding some helper functions. For example instead of this: ...
janos's user avatar
  • 111k
4 votes
Accepted

AngularJS recursive function call with $timeout

You're almost there. But first, a few code smells: ...
Joseph's user avatar
  • 25k
4 votes
Accepted

Returning the results of four $resource calls as a JSON array in AngularJS

Never, and I mean NEVER, manually construct JSON. That's just asking for trouble. Construct the object then use JSON.stringify. FYI, arrays are valid JSON so you ...
Joseph's user avatar
  • 25k
4 votes

Grab the first 4 items that meet the condition from a data set with an unknown size

So that would mean that very large datasets would increase computation time. You should ask if very large datasets are possible. Because if they're not, clean code takes precedence over what would ...
Jonah's user avatar
  • 4,340
3 votes

Recreating a URL string

Do you mean write code that would repeat the multiple if/else statements? cause that would be the right idea and make your code more DRY. The first thing to take ...
Nick's user avatar
  • 41
3 votes

Beginner's Calculator code

some comments on your code First, you are adding an intermediate layer which is not really doing anything. calcService does not serve any purpose in your code, you can call directly MathService from ...
A. Romeu's user avatar
  • 1,065
3 votes
Accepted

Implementing tabs with panes

Can I use separate controllers to initialize each Tabs to load the Pane? Yes. Actually, that's the beauty of Angular. You can do whatever you want. Is it good way to give separate controllers for ...
Joseph's user avatar
  • 25k
3 votes
Accepted

Conditional async validation function

Consider having your APIs return a promise instead. By the looks of it, success indicates that it's a Q promise which means it ...
Joseph's user avatar
  • 25k
3 votes
Accepted

Angular Promise trying Wrapper

Well, first of all you aren't trying a promise. What you're really doing is trying out a function that returns a promise. So the name is already misleading. Try something better. Next, ...
Joseph's user avatar
  • 25k
3 votes
Accepted

Simple Todo app

For Angular Best Practices (or very good practice) take a look at John Papa's Style Guide: https://github.com/johnpapa/angular-styleguide/blob/master/a1/README.md It is well written, easy to ...
Kevin's user avatar
  • 46
3 votes

SQL LIKE search in Angular filter objects

I think you inverted startLike with endLike. ...
Mario Santini's user avatar
3 votes
Accepted

Communication to Child Controller

Having to refer to $scope.$parent is absolutely bad-practice, because dependencies will go up and down and all sorts of ways in your application. It will become a ...
Vadiem Janssens's user avatar
3 votes
Accepted

Particle text directive

There's a few files so I'll focus on a more general code review. Overall it looks good! The code is well structured, readable and your logic is easy to follow. ES6+ You're already using newer ...
Craig Ayre's user avatar
3 votes
Accepted

Move an element up / down an array in Javascript

What you are doing isn't very efficient. First you remove the element from the array, and to close the gap, every single element after it has to move position. Then you insert the element again, and ...
Kruga's user avatar
  • 1,124
2 votes
Accepted

Asynchronous iterator for AngularJS

Regarding the desire to make an implementation of the $q service, it is useful to consider that angular's $q is a stripped down ...
Aluan Haddad's user avatar
2 votes

An object exposed to directives that need to track changes on it

...
Malachi's user avatar
  • 28.6k
2 votes
Accepted

Ionic REST + Authentication

...
Quill's user avatar
  • 11.9k
2 votes
Accepted

Currency converter using angular.js

First, variables. fromFound and toFound doesn't seem clear to me. What are they? I don't remember finding anything in the app. ...
Joseph's user avatar
  • 25k
2 votes
Accepted

Recreating a URL string

You can try this: ...
LostMyGlasses's user avatar
2 votes

Day, month and year clone in to one with MomentJS

All that fuss only meant: Moment will soon only parse ISO date strings. To parse arbitrary date strings reliably, you will need to describe the format via the second argument of the ...
Joseph's user avatar
  • 25k
2 votes

Simple AngularJS controller for REST API

Your "BasicResource" resource factory can be greatly simplified: before: ...
Aluan Haddad's user avatar
2 votes

AngularJS controller to fetch and display employee data from database

You should create a json object for your errors. Key - error number, value - custom error message. Try to be DRY. Just imagine situation, when i18n will be required.
Kindzoku's user avatar
  • 218
2 votes
Accepted

Add items to a list, or update the quantity if already in the list

I am not really sure about the needs but when you see something like this it should make you question if there is a better data structure. If you stored the parts in an Object for example keyed by ...
pllee's user avatar
  • 461

Only top scored, non community-wiki answers of a minimum length are eligible