All tagged javascript

The Sieve of Eratosthenes is a simple algorithm for finding all of the prime numbers up to a certain limit (or between two numbers).

If you wanted to find all the Prime numbers between 2 and 100 you could iterate from 2 to 100 and test if that number itself were a prime, but ain't no one got time for that.

Since a Prime number is only divisible by itself and 1, we can start from 2, and continually flag every multiple of that number up to n as false (not a prime). The next number would be 3, then we can mark every multiple of 3 to n as false.

Learning to Code: Week 35

This week I got deep into Hack Reactor Prep and spent a lot of time between that and working on toy problems either from FCC or J. Advice from a bootcamp grad on frameworks:

I would first get really comfortable with understanding Javascript fundamentals, then become literate in a JS framework. I’m not that crazy about these resources, but it’s a starting point. If you find better one’s please let me know.

Learning to Code: Week 32

This week was when the Master JavaScript class on Codementor really took off. The whole concept of a "stateful" application and unidirectional data flow blows my mind. Also this week I discovered the podcast Breaking Into Startups which is run by three guys, two of which went to Hack Reactor and App Academy! They ask the best questions and ones I want to know the answers to without veering off topic. I highly recommend anyone interested in tech or startups listen to it immediately.

Learning to Code: Week 31

I’ve been wanting to make a very simple “Weeks Until” calculator since all of the ones online give me too much information. Round up the nearest week and call it a day. So that’s what I decided to work on!

I got the basic functionality working using the Date() object and getDate and calculated the difference in times in days instead of milliseconds.

Once I could log to the console what I wanted I switched over to HTML. I put in a simple h1, h2, input field and submit button made it run myFunction() to log to the console what was received from the date input since I didn’t know the format. It came out in a string like YYYY-MM-DD

Learning to Code: Week 30

In the job search, a huge part of success is doing well on "technical interviews," which is where companies put you in front of a whiteboard (or an online code editor for first-round phone screens) and ask you questions about data structures and algorithms. I studied these types of questions prior to entering the course. How to arrive at the solution, how to best implement them in JavaScript, how to sketch them out in diagrams, etc.

A good site for beginner-level questions is since they let you see other people's solutions. You'll learn a lot of good language tips this way.

Learning to Code: Week 29

Just make sure you can handle functions that take functions as parameters. If you are familiar with the map, reduce, filter functions and how to write them then that covers what use to be the interview questions.

Also be sure to engage with your interviewer. I am in introvert so I was dinged by my interviewer when I didn't talk. If you don't understand how to do something then start talking and articulating how you would handle something. This shows them how you think and what you would do  and how you think you might solve it.

Learning to Code: Week 28

"On the job ready thing, don't feel like you have to wait until you are fully confident, or you may never do it. I've bit off jobs on things that I had never done before and forced myself to learn and deliver."

"On the what to say in an interview when you're stuck.  Never bullshit an answer. If you don't know, say you don't know. If you think you might know, but misunderstand the question, ask clarifying questions. If there was something that you knew, but misunderstand at the time, you can email the person back later. I did that on an interview once, and the follow up interaction started a great conversation."

Learning to Code: Week 25

Closures are still very confusing to me because every example I’ve seen so far I’ve been able to rewrite WITHOUT a closure and it works just fine, so I see absolutely no reason to use them on these simple examples, and no lessons so far have explained WHY they are needed.
I feel that it is a much more advanced technique to use variables outside of a function’s scope, but I can’t follow the advanced examples I see, and the very simple examples that use closures don’t need them! Arghhhh