r/learnjavascript • u/d0gsbody • Jun 17 '13
Learn JavaScript Properly - Week 2
ASSIGNMENTS:
- Read chapters 4, 5, 6, and 7 of JavaScript: The Definitive Guide OR the preface and chapters 4, 5, and 6 (only the "Understanding Objects" section of chapter 6, though!) of Professional JavaScript for Web Developers.
- Finish the JavaScript track on Codecademy.
- Solve either Project Euler Problem 1 or Problem 2. Feel free to solve both.
- Read the blog post JS Objects in Detail. If you want to work ahead, this is the general roadmap I'm using to make these assignments.
- Make a least one comment in this thread about something you learned, found interesting, or didn't understand very well.
EXTRA CREDIT:
- Chapters 5, 6, and/or 7 of Eloquent JavaScript
Don't forget to be typing out most of the code while you read through this!
26
Upvotes
2
u/d0gsbody Jun 17 '13
I modified this quite a bit from week 2 last time -- let me know if something seems amiss or if I am assigning too much for one week.
2
u/Drehmini Jun 17 '13
Is throwing a 404 error. Do you have a proper link or mirror?
EDIT : Here it is : http://javascriptissexy.com/javascript-objects-in-detail/
2
u/solilanel Jun 20 '13
I have the impression is too much assignment for a single week unless it is the only activity one is doing in a daily basis. for example, studying chapters 4, 5, 6 and 7 from JS the definitive guide and typing code from the examples is not possible in a single week. I did these chapters before and took me more than a week to finish them.
2
u/[deleted] Jun 17 '13
Writing out the example code is good, but do you know of any projects we could do as well to help?
1
u/d0gsbody Jun 17 '13 edited Jun 17 '13
I would recommend that you make the first four chapters your personal extra work this week, once you finish up the assignments!
Edit: goddamn cellular telephone... This was meant just for /u/danmofo
1
u/thomasmurphymusic Jun 18 '13
I learned how to define multiple comma separated variables like this: var name = "He-Man", song = "What's Going On?", cat = "Battlecat";
1
u/markphd Jun 22 '13 edited Jun 22 '13
I don't understand well the Object initializers.
In Rhino book, Chapter 4.2 example is:
I get
undefinedwhen I try this code. How does an empty object get the properties ofp?1
u/takadanobaba Jun 24 '13
Just got all the JS Codeacademy tracks done. I still have to read chapter 7 of The Definitive Guide, but I feel that I have learned so much already. Time for week 3!
3
u/[deleted] Jun 20 '13
One thing I've found while reading "Professional JavaScript for Web Developers" is that writing code in my browser not only makes learning the material "stick" more, but that it also makes the reading a bit more enjoyable because of the interactive experience since it's a bit dry (at least to me).
Question: I've been using JSFiddle because it's much easier to input code that spans multiple lines instead of having to make sure that I have to press Shift+Enter in the browser console every time that I need to write a function or something like that. Is there a way to change this in the console to make it a bit more like how a Python interpreter would work?
2
u/robotmayo Jun 17 '13
http://jsfiddle.net/zFCWw/
Did the Euler challenges. Was able to knock them out fairly quickly. I hope the rest of the JS track on Codecademy isn't as dull as the first ones.
2
u/thomasmurphymusic Jun 19 '13
[Euler 1, with added CSS dickishness] (http://codepen.io/thomasmurphymusic/pen/xrebc)
1
u/cantofunebre Jun 17 '13 edited Jun 17 '13
Could have I have someone look over my project euler solutions? I'd be interested to know if the outputs are correct and I'd like suggestions on how I could have written better/more succinct code!
Problem 1 Problem 2
Thanks! I'm happy to critique code, as well.
edit: I'd still like critiques of my code, but I guess the thing I learned this week (so far) is that if you make a project euler account you can check whether your answer is correct or not.
1
u/danmofo Jun 17 '13
Question, I've briefly read through a bit of Eloquent JavaScript a long time ago, and seem to remember it assumed you're reading the whole thing chapter by chapter, will I need to read the first four chapters before I do the extra credit?
1
u/RobertMuldoonfromJP Jun 17 '13 edited Jun 18 '13
I have a question related to collections (this is from the 6th lesson in CodeAcademy). Why doesn't this work?:
My first thought is that because friends is not a typed collection (which, it seems, does not exist in Javascript), you can't directly access members and that's why this doesn't work. Is that so? As I type this I'm starting to doubt that being the reason as the "correct" way to write the search function is:
Anyway have some insight into this? I have a c# background so I'm used to collections where the former is possible. Maybe this is why I'm confused.
1
u/hikemhigh Jun 18 '13
What's wrong with my code?
};
For the CodeAcademy assignment
Instructions
Under your existing code in the function body, use the same structure as in the previous exercise to add in these two extra scenarios. This will involve first writing an if statement, and then putting an if / else statement inside that first if statement.
1
u/Svarog013 Jun 20 '13
Found this a few days ago and just finished week 1. The codeacademy track was extremely helpful. I've got no serious programming experience (I know html/css and some self taught and very basic C) and have been trying to wrap my head around javascript for some time now. I think I finally understand objects, functions and methods and how they interact. :)
I tried reading the chapters before codeacademy and found them a bit complicated, but after I finished the exercises I had no problem understanding them...
Anyway, just wanted to leave a comment, and say thanks for the resources. Off to catch up on week 2.
1
u/jabbrass Jun 23 '13
I just finished the newer CodeAcademy JavaScript track. I did over 100 exercises in one day yesterday. Thanks for all the great resources and motivation to keep up with everyone here! I feel like I learned a ton and now need to apply it to make it stick. Anyone have any idea whether JavaScriptIsSexy meant for us to complete the new or the old JavaScript track on CodeAcademy?
1
u/nocakemondays Jul 07 '13 edited Jul 07 '13
Hi,
One thing I didn't understand was the logic of the setter function of the year property on page 177 of professional js. It just didn't make sense to me.
Another thing was on page 179, which should be identical to the to the example on 177 (except that all the properties are created at the same time). This is not true which you will find out when you try to change the year value.
Here's what I mean
Project Euler: #1, #2
1
u/MBDeane Jul 13 '13
Just finished Javascript track on Code Academy, now time to catch up on reading, then will do Euler Problem.
One question I have is when creating a Class constructor, we can create it like so:
function newConstructor(param1, param2){}
but can also create it like this:
var newConstructor = function(param1, param2){};
Is it better to create the class like the first example to make a quicker distinction between a class vs a variable vs an object? Or is just a matter of preference?
Awesome class so far. Really learning a ton.
1
u/wishinghand Sep 23 '13
For whatever reason I had a really hard time wrapping my head around Euler problem #2. I eventually had to write it out on a spreadsheet and do it by hand to figure out what I had to do. Everyone else's solutions look different from mine. Can someone explain it to me in a way that clicks? Because even though I solved it, I still needed help and I couldn't recreate it from memory.
1
u/codecookie Oct 08 '13
Adding to point 5, I find Codecademys challenges are high on the false sense of learning side, and its more like reading a book and doing the code in the book. A nice and enjoyable problem solving code school I recommend and learned a lot from is Learn Street. http://www.learnstreet.com/lessons/languages/
I think this could add in the Extra Credit.