I'm in the middle of learning JS and jQuery. I try and create a random tool at least once a week to test how my learning is going, and this is my latest experiment: http://jsfiddle.net/joshnh/UBQvL/
Now, originally, I was using nested for loops (http://jsfiddle.net/joshnh/UBQvL/9/), but I have since discovered that this is a bad idea for performance reasons. I have defined functions to try and get around this, but is defining a function inside another function just as bad?
What is the best way to do what I am trying to do? Have you got any other improvements for me? Thanks in advance guys.
Slightly related aside; should I define a function like this:
@joshuanhibbert - nice application, josh. I am also learning jquery at the moment and was wondering how you go about setting yourself projects? I am working purely off exercise files at the moment and thought it would be good to move away from that and do my own stuff. The problem is I find it hard choosing what to do. Any suggestions?
@karlpcrowley: I mean, make a duplicate :p Honestly, I don't understand why they use the term 'Fork', while when clicked, the opposite is duplication, not flying cows.
@tobeeornot I struggle with finding things to create and practise with too, but any time something pops into my head (usually from a discussion with someone) I attempt to create a tool. I much prefer creating my own stuff over following tutorials, and I find that having to figure out issues on my own is the best way to learn. The other thing I do is try to recreate popular things on my own. Things like this, this, this, this, this, this, this, and this.
Not all of those are working 100%, but feel free to play around with them!
@karlpcrowley Thanks for those links mate, I'll have a look at them now! Great looking fork too :D
@joshuanhibbert - thanks very much for that. I think that is really good advice. Sometimes I am keen to move on quickly after finishing tutorials and come to doubt myself later as to how much I have absorbed. I think what you are doing sounds like the best method.
Now, originally, I was using nested for loops (http://jsfiddle.net/joshnh/UBQvL/9/), but I have since discovered that this is a bad idea for performance reasons. I have defined functions to try and get around this, but is defining a function inside another function just as bad?
What is the best way to do what I am trying to do? Have you got any other improvements for me? Thanks in advance guys.
Slightly related aside; should I define a function like this:
Or like this:
@joshuanhibbert
Here's a decent writeup about your predicament
http://www.dustindiaz.com/javascript-function-declaration-ambiguity/
Also this is fun https://gist.github.com/659424
Honestly, I don't understand why they use the term 'Fork', while when clicked, the opposite is duplication, not flying cows.
Where I come from "Fork me" is not a nice term lol
@tobeeornot I struggle with finding things to create and practise with too, but any time something pops into my head (usually from a discussion with someone) I attempt to create a tool. I much prefer creating my own stuff over following tutorials, and I find that having to figure out issues on my own is the best way to learn. The other thing I do is try to recreate popular things on my own. Things like this, this, this, this, this, this, this, and this.
Not all of those are working 100%, but feel free to play around with them!
@karlpcrowley Thanks for those links mate, I'll have a look at them now! Great looking fork too :D
Also, that inception gist is awesome!