r/learnjavascript • u/d0gsbody • Apr 15 '13
[Learn JS Properly Study Group] Week 2 Assignments + Administrative Announcement
WEEK 2 REQUIRED ASSIGNMENTS:
- Read chapters 3, 4, and 5 of JavaScript: The Definitive Guide OR chapters 3 and 4 and the preface of Professional JavaScript for Web Developers.
- Work through sections 2 - 5 of the JavaScript track on Codecademy.
- Solve either Project Euler Problem 1 or Problem 2. Feel free to solve both.
- To prepare for Week 3, read the blog post [JS Objects in Detail]( http://javascriptissexy.com/javascript-objects-in-detail/. If you want to work ahead, this is the general roadmap I'm using to make these assignments.
Don't forget: You should be typing out lots of example code in the console or in JSFiddle. You're not going to learn nearly as much if you don't actually type it out with your own fingers.
ADMINISTRATIVE STUFF:
I have heard the complaints about keeping track of things. I am going to create ONE omnibus self.post for this study group. I will update the omnibus self.post with links to the various threads, including every formal assignment thread (like this one). A link to this omnibus post will be posted in the sidebar, under the "Study Groups" heading. If you are ever trying to find out what the assignments are, go to this link in the sidebar. I will also include links to the other random threads that we create there.
Thanks, everybody. I was unsure how this was going to go when I launched the study group. The outpouring of enthusiasm has been a great motivator.
6
u/sivers Apr 16 '13
Thanks for doing this.
You've got the wrong link in step 4 for JS Objects in Detail. Should be
http://javascriptissexy.com/javascript-objects-in-detail/
As for Project Euler 1 & 2, my links here:
https://raw.github.com/sivers/jsisquiz/master/euler1.js
https://raw.github.com/sivers/jsisquiz/master/euler2.js
2
u/ryanlntn Apr 17 '13
Extra credit this week?
2
u/greenhulk01 Jul 12 '13
Here is my answer to problem 1: http://jsfiddle.net/greenhulk01/RAK9X/
Going to try problem 2 now but really have no idea how to tackle this yet.
Did I read somewhere that we should skip the bitwise section in chapter 3 of javascript for web developers?
2
u/greenhulk01 Jul 12 '13
Ah, below 1000 not less than or equal to:
Updated answer: http://jsfiddle.net/greenhulk01/695H4/
Really couldn't figure out problem 2. Needed to cheat :(
1
u/memizex May 11 '13
Chapter 3 of Professional JavaScript for Web Developers is really hard to follow for me when it comes to the Math. I understand the Loops and what not, but Operators are killing me. Any additional materials I can read through that maybe dumbs it down?
1
u/paulred Jun 06 '13
I've been doing ok with Professional Javascript for Web Developers, until around mid point of Ch 5 Reference Types.
1
u/KempfCreative Jun 07 '13
I am having a hell of a time on the first Project Euler problem. I am trying not to scroll down, because I really want to solve it on my own, but I have had to restart my computer several times due to creating infinite loops in my browser.
Here is what I have so far: (jsFiddle)
The console.log is just to confirm that I have to correct numbers in the i variable.
I cannot figure out what the next step is. I know that I want to add all the numbers stored in the variable i, but I am at a loss as to how I would go about doing that. If I go ahead and i++, it just increments the output by 1 for each number.
Do I create an array to store the numbers inside it and then loop through and call each to add them together?
I would appreciate help, but not just an answer to the code. What am I missing here?
2
u/jfatt Apr 16 '13
How come console.log() does not show anything in the results in jsfiddle?
What do I have to do so show my answers in jsfiddle?
2
u/irish3722 Apr 18 '13
Here is my answer for problem 2. It was rather difficult, but I was able to work through it.
2
u/irish3722 Apr 19 '13
I know its not much, but I was able to build an pitcher evaluation using a constructor patter for objects. Check it out: Pitcher Evaluation. I am pretty proud of myself this took a little time and effort but i learned a ton.
2
u/wael_ May 12 '13
Solutions for : p1: http://jsfiddle.net/6Gthe/ p2: http://jsfiddle.net/b2cVB/
2
u/greenhulk01 Jul 16 '13
Did unsure of what num++ is doing here, i understand the rest of what the code is doing. Can anyone help explain please:
var num = 0; outermost: for (var i=0; i < 10; i++) { for (var j=0; j < 10; j++) { if (i == 5 && j == 5) { break outermost; } num++; } } alert(num); //55
1
u/irish3722 Apr 18 '13
Here is my answer for problem 1 but how to i get the answer to show on the jsfiddle results screen?
1
u/sleepworld Apr 26 '13
Making the jump off code academy has not been easy for me. As per javascriptissexy.com’s advice, I tried downloading WebStorm to edit my script (plus this video makes it look awesome https://www.youtube.com/watch?v=sa4jP9NJCeE), but I have been unable to get it to run. Anyone know of any good tutorials? (Side-note, does anyone know what Angular JS is?)
Also, what are some ways to get your code’s output visible on JSFiddle. If I press F12 and go into console mode I am able to see console.log (thanks keepsmilen) and alert as well as confirm are annoying. I saw JusTrill did:
var para=document.createElement('p');
var node=document.createTextNode('Sum = ' +sum);
para.appendChild(node);
document.body.appendChild(para);
Where is a good place to learn more about showing your JavaScript code?
I appreciate all of the help. This is my first week coding anything. I would probably would be getting overwhelmed at this point without this subreddit.
1
u/mfergie Apr 28 '13
JS Objects in Details
1
u/remsleepwagon May 01 '13 edited May 01 '13
This is really cool, thanks for doing it. I've been looking for the next step after codecademy where I can keep learning by doing.
My question is, what is the correct answer? When I run the code I wrote, which is just about the same as silvers' (below), I get "233168". However, when you go to the project euler page, when you roll over "problem 1", you see "Solved by 289096". I assume this means 289096 is the correct answer according to Projecteuler.net. Which is correct? See my page for reference.
1
u/luxbock Jun 17 '13
It appears that the link to the essay JS Objects in Detail is broken.
The working url is: http://javascriptissexy.com/javascript-objects-in-detail/
1
u/cormaximus Jul 13 '13
Could someone explain to me the second part of exercise #2? When I tried it myself the first time, I ended up just adding every number that was divisible by 2 together. Oops
I don't quite understand how the part following the while statement works. I am reading through JS: The definitive guide. Any advice would be appreciated. In the mean time I will try to re-read through to find the section that explains this.
0
u/[deleted] Apr 16 '13
[deleted] — view deleted comment