TradeNurkicNow
piss
- Joined
- Sep 16, 2008
- Messages
- 5,197
- Likes
- 679
- Points
- 113
Hello fellow nerds.
This should be basic, I hope. I have dabbled in coding in the past so I kind of think I know what I'm doing, but I don't apparently. I know only basic javascript (for/do/while loops, arrays, functions, etc). I was messing around and trying to write a little program that takes a piece of text and draws letters from it in random groups of 1-7 and then spits them into a text string with spaces in between. Just for fun. Or art, whatever.
So, I got it to work (although my coding isn't exactly... elegant). However my problem is, the output always has too many spaces. Here is a link to my project.
http://labs.codecademy.com/hEB/1#:workspace
I made comments so you can see what's happening. Basically there is an if/else imbedded in a while loop, and the else statement (containing the code to make a space) seems to sometimes run more than once. I can't for the life of me figure out why it would run more than once, but it does consistently.
Anyone?
This should be basic, I hope. I have dabbled in coding in the past so I kind of think I know what I'm doing, but I don't apparently. I know only basic javascript (for/do/while loops, arrays, functions, etc). I was messing around and trying to write a little program that takes a piece of text and draws letters from it in random groups of 1-7 and then spits them into a text string with spaces in between. Just for fun. Or art, whatever.
So, I got it to work (although my coding isn't exactly... elegant). However my problem is, the output always has too many spaces. Here is a link to my project.
http://labs.codecademy.com/hEB/1#:workspace
I made comments so you can see what's happening. Basically there is an if/else imbedded in a while loop, and the else statement (containing the code to make a space) seems to sometimes run more than once. I can't for the life of me figure out why it would run more than once, but it does consistently.
Anyone?

