Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript JavaScript Basics (Retired) Working With Numbers The Random Challenge Solution

Keiran Kainth
Keiran Kainth
21,105 Points

Anyone else feel like this with JavaScript, or just me?

I get the syntax (so I'm not one to miss the ;'s, or put a capital letter in the wrong place, or forget that I made a number into a string by putting quotes etc...)

I get most of the meaning behind the actual code performing 'singularly' (as in what it actually does to perform single commands etc)

...and I get how to make variables and random numbers etc...

But when it comes to 'logically constructing' these codes together to create challenges and solve problems effectively, I can't seem to do it?... As in "getting all the segments to fit and actually work", kinda' thing.

Is this just a lack of skills / practice thing, or is this perhaps an 'aptitude' thing? Anyone else feel the same. All answers appreciated.

I can't seem to 'string it all together' to get to the bottom of the actual solutions to the challenges, without actually skipping and then watching Dave do it.

10 Answers

Michael Afanasiev
PLUS
Michael Afanasiev
Courses Plus Student 15,596 Points

Hey Keiran,

I feel exactly the same way! I strongly recommend taking the CS50 course by Harvard from edX. I am currently on Week 3 out of 12 and I have learned so much from it! I mean it, TAKE IT! :D

Keiran Kainth
Keiran Kainth
21,105 Points

Great stuff, thank you. I will certainly check it out!

Arikaturika Tumojenko
Arikaturika Tumojenko
8,897 Points

Hey Michael,

I know it's been 5 months since you were mentioning this course on edX but I tried to find it and I couldn't. Any idea why? Is it possible they don't have it anymore? Thx.

Karolin Rafalski
Karolin Rafalski
11,368 Points

Yes! I totally relate!

I think it's a lot about just practicing. I took an admissions exam for a bootcamp that had 5 fairly simple questions and totally bombed it. I could not get one thing to work. After crying for several hours, I resolved to figure stuff out. I remembered what the questions were (test a string to see if it is a palindrome...) and I worked on solving them. It took me over a week. I reviewed Dave's lessons (which I think are the best, but just not enough), joined code academy and started going through their lessons, got a free electronic copy of Eloquent Javascript, read and worked through the first few chapters of problems there(very hard but very worthwhile to really try to do it on my own- when I finally got it, I REALLY GOT IT), and started working on the problems available on coderbyte (no, I cannot solve any of them in the time allotted for bonus points, they usually take me an hour to a few days to solve).

Then, about after a month of working on things this way, I went to a free JavaScript workshop with about 30-40 people and I actually was able to work through the problems in the given timeframe of 20-30 minutes. The majority of people were stuck in the 'but I studied a lot, but I just don't even know what to start typing' way. Which is where I was a few weeks earlier.

There are days I feel that just rolling a potato across my keyboard would come up with better code than I could. Then there are other days where I get a little line of code and feel super awesome. From talking to other people, this seems to be a pretty normal way to feel.

@Jacob- thanks for the MIT link! It looks like a great resource!

Karolin Rafalski, not a problem. I hope it helps, also you're totally right, its important to practice and write every day. Taking logic and other course to supplement the learning here is very important. It's a lot more work but I believe it will make you a stronger programmer in the long run.

Keiran Kainth
Keiran Kainth
21,105 Points

Thanks :-), yes deffo agree! Great development btw

I've been suggested that book more times than I can count but I hate reading on the computer.

Would you say Eloquent JS was the turning point? If so, I'll splurge on a paperback copy of it. (they've been awesome enough to give it away for free for so many years...)

Karolin Rafalski
Karolin Rafalski
11,368 Points

The book is a bit of an odd duck - in some ways I have felt I really learned from it, at other points I have had to completley rely on other resources and felt very frustrated with it.
At this point I would say it's more of a 'review and test yourself' book than a 'learn this concept for the first time from this book.' I would say, check out some parts via the free pdf, if you like it, buy it. And I also prefer hard copies of coding books- otherwise too many screens to look at!

Jessica Larsen
Jessica Larsen
1,690 Points

"There are days I feel that just rolling a potato across my keyboard would come up with better code than I could."

Pure poetry, Karolin. Pure, totally relatable, poetry. :)

I hear yeah, and yes you're right. It's really hard to "just know" how to do things after watching a video. I had this problem for a while, and I decided to supplement my Treehouse learning with MIT's free Computer Sciences classes, and logic classes. I highly recommend you watch these lectures and take notes on them. It will greatly improve your understanding of Computer Science and Coding in general.

MIT Open courseware

Keiran Kainth
Keiran Kainth
21,105 Points

Ok good stuff, that's great to know. Thanks for the link, will look into them all.

Take a look at the link I sent and also look for a basic logic class, it's going to use programming as examples but it will teach you how to look at a problem and break it down logically.

Lisa Ess
Lisa Ess
7,193 Points

Yeah, I was understanding variables and all that, and then we hit the math and I feel like something was left out, like either this wasn't explained well, or my abysmal math brain just went "NOPE" and got stuck.

I am baffled by everything that just happened in this video. I feel like there is more expected than has been taught.

Arikaturika Tumojenko
Arikaturika Tumojenko
8,897 Points

I had the same feeling. I've spend a few hours trying to understand and after I couldn't do it I just gave up. I must be very bad at math.

I always feel like this, and I feel like a lot of people feel the same way. Personally, I think it's because I never properly learned programming at a college or really took the time to learn it in my free time (something I'm remedying right now).

I can tell you that with practice, particularly by working on silly little projects you're passionate about, you'll get better. Things will just become second nature even if you don't thoroughly understand what's going on behind the scenes.

That's not really a good thing though. It means you'll write code and debate with people just based on your habits, not by critically thinking.

Sorry I don't have much advice for this situation. I suspect practicing math on Khan Academy will strengthen that part of the brain.

One thing I'm surprised nobody mentioned is design patterns. Learn as many as you can and practice implementing them. Really try to understand why they're best practices and you'll start writing better code. https://addyosmani.com/resources/essentialjsdesignpatterns/book/

Oh, and the random integer between 2 numbers thing is just JavaScript being garbage. Here's how you do it in Python: random.randint(1, 10).

Unless you're looking for a JS job in the next few months, it might be a good idea to learn how to program with a simpler language like Python.

Best of luck.

Keiran Kainth
Keiran Kainth
21,105 Points

Great, will do. I eventually want to get into software programming/engineering too, so all this will be of very high value.

I would totally take a look at it. this is the logic is started taking a while back:

MIT Logic Class

I would take a look at both and see which one fits for you.

All about practice and once you understand it, even when you come back months/years down the road, you will pick it up again fast. I haven't done js since august but rather did other progrmaming tracks here (java/android) and now that ive restarted js, it is definetely a lot easier than the first time. But once you understand these concepts, these concepts will spread into every single programming language and your life will be a lot easier

Keiran Kainth
Keiran Kainth
21,105 Points

Thanks. Yeah soon as I drill it into my muscle memory and practice consistently I'll be sure to understand it a lot better, often all the 'logic' gets me, but looking into this roadblock heavily as well.

Same here, feel like getting the basics, but when I saw challenge question from fullstack academy, I have no idea whats going on.....

You do realize this is not fullstack academy, right? the videos and challenges here are designed in congruence with each other, so if you are learning here and then taking quizzes someplace else, you might not be learning what the quizzes were based on. best to stick with one learning platform.

what I mean is knowing the concept is still far from solving the whole problem,

Kyle Vassella
Kyle Vassella
9,033 Points

I felt the same way, and this was really the first video/challenge in the course that made me feel this way. Super discouraging - maybe I just need more reps, but perhaps maybe I just don't have the aptitude for it as you say. I'll keep trying though - the people above gave some really helpful input and links.

Karolin Rafalski
Karolin Rafalski
11,368 Points

Keep trying!

Watch some videos about grit: https://www.ted.com/talks/angela_lee_duckworth_the_key_to_success_grit?language=en

Read about the growth mindset: https://www.brainpickings.org/2014/01/29/carol-dweck-mindset/

The most important thing to ask yourself is if you enjoy studying/learning the material/doing the work. The rest will come with time and practice.

I wouldn't discouraged at all. There is a reason that they have a video explaining the process. It's totally about reps and its about understanding the concepts being applied. Remember you can always ask questions here and search for questions. NO ONE knows everything, One of the greatest tools for a developer is using Google search. No Lie. If this is something you really want to do, stick with it, and it will click.