Week two was just announced, and here are the assignments for the week!
- 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. 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.
In this post, mr_noah is posting his answer to the Project Euler practice problems and he uses the following code to output his sum to the document body:
$("body").append("<p>runningTotal = "+runningTotal+"</p>");
I tried to do the same, but it didn’t seem to work. I then realized he had imported a JQuery library. I wanted to use pure JS, so I went to trusty Google and found a solution that worked without using JQuery:
var para=document.createElement('p'); var node=document.createTextNode('Sum = ' +sum); para.appendChild(node); document.body.appendChild(para) console.log(document.body);</span>
It feels really good to see everything coming together! I used some of the CSS that I learned from Codecademy just to dress up my output page a bit. See my solutions to the Project Euler Problem 1 and Problem 2.
I’ll post the full Week 2 review review once I finish up the rest of the assignments. Cheers!