Skip to main content

Posts

Showing posts with the label JavaScript

10 week update

    With the exception of the week over Christmas, I have been studying coding for every week for 10 weeks now. I estimate that I have spent 300 hours on study so far. Realistically, not all of that time was spend coding, much of it was spent reading forums looking for help, watching lectures, reading books as well as brushing up on mathematics. So, perhaps half of the time (150 hours) could truly be called coding practice.    Without a mentor, it hasn't always been easy deciding on the path to take. I spent the first 2 weeks on Java, as that was the first course I found. Then I discovered The Odin Project and spent the last 7 weeks learning Ruby, Javascript and SQL. Over the last couple of weeks I started some Python study, including an online course.  Just before Christmas I also discovered FreeCodeCamp which focuses on Javascript.  I believe that I've finally discovered the best path. Last week I volunteered as a mentor at my first CoderDojo. Last n...

Week 5-Progress

Going into week 5 I feel I am making great progress.  Yesterday I completed and submitted my Javascript Etch-a-Sketch project for Web Development 101. It's not perfect, but I added a couple of extra features (such as colour choice)-one improvement I could make is to change the colour choice to a radio button format and allow colour change without erasing the image. In the end, the project only took a few hours, but that was after going through HeadFirst books on HTML/CSS, JavaScript and jQuery. For some reason, my brain was stuck in HTML mode and I couldn't see how to create the webpage using only Javascript. Once I remembered the jQuery method of creating HTML elements, it was easy.  I spent some time trying to figure out how to increase colour intensity with each mouseover event. The pseudocode is easy, but I can't get the Javascript syntax right-I will go back to it  when my Javascript has improved. I spent the last day completing the Codecademy Ruby course-mo...

Elegance

Here's an example what 'elegance' means in programming. These are three solutions to a Project Euler problem .  All three programs do the same thing-find prime factors of a given number. (I've removed comments). The relative sizes of the scripts are 1.285kb, 0.694kb and 0.139kb respectively. 1) var biggestPrimeFactor = 1; var numberToFactor = 600851475143; var factorArray = [] for (i = 2; i <= Math.sqrt(numberToFactor); i++) {     if(numberToFactor % i === 0) {         factorArray.push(i);         var isPrime = true;         for(j = 2; j <= Math.sqrt(i); j++) {             if(i % j === 0) {                 var isPrime = false;             }         }         if(isPrime === true) {             biggestPrimeFacto...