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) Making Decisions with Conditional Statements Combining Multiple Tests Into a Single Condition

Rich Braymiller
Rich Braymiller
7,119 Points

well...

I'm getting pretty lost with JavaScript, particularly with boolean, maybe I'm not cut out for this...don't think this is normal. I dont know.....

Blayne Marjama
Blayne Marjama
5,328 Points

I'm on the struggle bus with you right now, man. But we have to power through it and learn as much as we can. In the wise words of Shia Labeouf - "Just. Do it."

11 Answers

Kevin VanConant
Kevin VanConant
1,833 Points

I know HTML and CSS like the back of my hand also know come C# and C++. Javascript.... not very fun. Once it clicks you just understand it. I still have some issues with Javascript myself. I just had to watch a few videos again to help brush up because I haven't done anything in the Javascript course in awhile. You will get the hang of it. Too many people give up before they get over the hurdle and then they just forget programming all together. Stick with it watch the videos a few times especially the problem areas and you will pick it up. (I've been developing websites for about 6 years) Just started getting into Javascript because my friend who did the Javascript programming doesn't have time to help with it so I'm having to learn more about Javascript.

Happy Coding and good Luck!

Dear Rich,

Don't give up. Be patient with yourself and don't expect miracles overnight. Everyone learns at their own pace and yours is just fine. You'll be glad you stuck with it.

Love,

Future Rich

Future Rich. Good one there!

It's a language. If you are learning a foreign language, there is a steep learning curve til you get it. You shouldn't expect a programming language to seep into bones overnight. Here's another perspective. I am, ahem, quite mature and am learning program languages for the first time. Yes, I do know html and css quite well, but they aren't programming languages. Last quarter I tackled SQL, C#, and JavaScript. If I can maintain a 4.0 doing this at my age, you can conquer JavaScript. Give it time and a lot of practice.

A related suggestion: I do all the exercises in Notepad++ so that I have a library of snippets to refer back to.

Hey! I read this blog a little while ago and I refer to it every time i get down about coding. Most of my friends are programmers and can attest to it. dude give it a read. It puts things into perspective.

http://www.vikingcodeschool.com/posts/why-learning-to-code-is-so-damn-hard

I am myself in the desert of despair phase, of learning how to code. if you stick with it the upswing of awesome does happen.

That was a good read, thanks for sharing Jacob!

I figure I'm in a loop near the end of 'The Desert of Despair' and the beginning of 'The Upswing of Awesome'. I'll typically devote a few days to learning something new and abandon it to go learn the next new shiny thing. For example, I'd really like to learn the MEAN stack, so I spend a week on Angular 1.x, but then I find a job posting requiring PHP MVC experience - so, I switch to learning Laravel. Then, I get the itch to learn SVG to help reduce the number of HTTP requests on the server for image assets (social media icons or basic shapes)... ad infinitum.

Still having fun though!

Robert,

I'm glad you liked it! yeah man, learning how to code is most certainly a process. A rigorous one at that, but so rewarding. Every level up, how ever small is just so sweet. For me Its just JavaScript, and maybe starting Swift. Its about learning what i want to build and how to build it. I totally understand the shift when seeing a job post, I would say just stick with what you love to do, no matter what program it is, there is a company that needs a good dev using that program(for the most part).

Jacob thanks for the link.

Samuel, Not a problem. I'm glad you found it to be a good read!

Rich Braymiller
Rich Braymiller
7,119 Points

just the whole logic of it. It's like I'm in a fog...and can't wrap my head around it...

Colin Bell
Colin Bell
29,679 Points

Boolean is just a data type with exactly two possible values: true or false. A boolean can't be anything but one of those two things.

Is grass green? The boolean value of this question is True

Is 2 a smaller number than 1? The boolean value of this question is False

Hi Rich,

This is normal. Even as you become more experienced, the fog is still there - but, you can see a little farther. Give it time, take plenty of breaks, and don't feel discouraged by having to revisit videos or some fundamental topic - I do all the time. Something I find helpful is that when I hit a wall, I switch topics.

Also, I learn more when I'm trying to help others, because I have to do the research and testing before presenting a solution or path to the solution. Helping others is also an exercise in helping myself - try it out!

Kind Regards

I feel the exact same way. It reminds me of high school when I started to struggle with complex algebra or trigonometry. Keep on keepin' on!

What are you having problems with? Is it the code or the concept of a Boolean?

Maybe its not the place to say this, but again maybe it is! I apologize if this has already been said.

I stopped studying for a couple weeks :-/ and when I came back I found myself in a place I didn't understand and it was really frustrating and I was feeling helpless, but then I get an idea to go back to the beginning of the project I was working on and just start over with it (not the beginning of the video, but the beginning video of the particular series where they introduced the new workspace), and things started to click and get exciting, and now I'm doing amazing!

Also... if you have the type of attention span that makes it hard to focus, do yourself a favor, and go to http://evernote.com, and make a free account if you don't already have one. Take DETAILED notes as you go with the two different browser windows open: treehouse in one window, and a workspace and an Evernote tab in the other. That alone's been really helpful, so that before I need to go back a video or two, because I don't understand, I can go back to my Evernotes, (since not all the courses have the teacher's script on them anymore..)

Anyways... I hope this helps anyone who comes across it and is feeling discouraged.

The goal of $60K is enough annually to make me not want to give up. (some CSharp coders make $100K A YEAR..)

Just sayin! Stick it out!

RICH!!!! I think I see now what you were talking about.. Boolean is weird and it's hard to understand. Let me know if this helps...

With Boolean, there are only two answers.. true or false. AS YOU ALREADY KNOW.

However, in the video, when Dave changed something like this: (example)

var greenHouseGasIsBad = 'true';

and said

if(greenHouseGas) { alert('<p>Greenhouse gas tastes great!</p>'); }

and it worked.. I was like... WHAT!???

It's because with Boolean, the only options you have are true and false. if(2===2), the answer is true, so you follow through on the following action.

Later on in the Boolean test when they ask:

What does this condition evaluate to: true or false? ( true && false )

The reason the answer is FALSE is because the system reads this as

(if true = true) AND (if false = true)

and that outputs as 'false'.

Sorry for the long post.. but a light bulb went off in my head and it all clicked when I realized that. Does that make sense?

Colin Bell
Colin Bell
29,679 Points

Don't put quotes around values you want to be boolean, otherwise they become strings. Only empty strings return a false value.

Boolean false values are:

  • undefined
  • null
  • NaN
  • 0
  • "" (an empty string. Its length is 0)
  • false

Notice, if you were to have:

var greenHouseGasIsBad = 'false';
if(greenHouseGasIsBad) { alert('Greenhouse gas tastes great!'); }

You'd get the alert because 'false' isn't an empty string.

Here is a good write up for anyone who wants to read more: Truthy and falsey

The cool thing about Booleans is that they are simple *only True or False, yet complicated enough. Same boat man but I think I already got it after a while.

Rich, I am right where you are at the moment, very discouraged, however I think that is why this is worth pursuing even more. Once through the gauntlet of self doubt and defeatism I think we'll both come out of this with good results. var results = ("good"); (see, I think my syntax is wrong there..) I'm rootin for ya! keep on keepin on!

CHETAN MALIK
CHETAN MALIK
4,346 Points

What i love about this discussion and this project is the wonderful community and the wonderful group of people(soldiers) who are ready to carry you on their shoulders when you are tired or about to give up. Keep going on Chris and this is from a guy who did not know what microsoft is before 3 years. God bless y'all. Thank you.