• Monday , 6 July 2020

JavaScript Tutorial For Beginners #12 – If Statements

Code Canyon

Hi all. In this JavaScript tutorial for beginners, we’re going to take our first look at control flow – if statements. If statements are alive everywhere you look in the world. If you perform an action, there will be a corresponding reaction or result. This concept is used in programming too.

If statements can be used to check a variety of things in JavaScript, such as whether a certain element has a particular class associated with it, or to check if an element is showing on a web page. They’re an extremely important aspect of JS, and will be VERY helpful in your future coding!

As usual, any questions just ask away :).

SUBSCRIBE TO CHANNEL – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg?sub_confirmation=1

========== JavaScript for Beginners Playlist ==========

========== CSS for Beginners Playlist ==========

========== HTML for Beginners Playlist ==========

========== The Net Ninja ============

For more front-end development tutorials & to black-belt your coding skills, head over to – https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg or http://thenetninja.co.uk

========== Social Links ==========

Twitter – @TheNetNinja – https://twitter.com/thenetninjauk

Original source

3d Ocean

Related Posts


  1. Kristen Cordes
    November 11, 2019 at 18:41

    Question – Noticed you put the <script> tag in the body of the .html page. Can you clarify when you would put the tag in the <head> and when you would put it in the body. (I do know the placement order in the body matters)

  2. hassan
    November 11, 2019 at 18:41

    i love you man

  3. saniya .s
    November 11, 2019 at 18:41

    My bracket live preview isn't working ..how to connect to browser

  4. Happy Shah
    November 11, 2019 at 18:41

    5:32 I hope you mean that my number is greater than 9.

  5. Sara Bree Wolf
    November 11, 2019 at 18:41

    What I don’t understand is the combination of what I would called a regular statement like “I like meat” and using num to get the true or false return. Is there an example that we use in daily life or on a website that would help clarify why we would ever use nums instead of just saying if”I like meat” = true else = false? Thank you btw these videos are saving me!

  6. Astha Gaur
    November 11, 2019 at 18:41

    I am getting 'document is not defined' error after excluding same code which is mentioned in video

  7. Yogesh Sh
    November 11, 2019 at 18:41

    You like meat..LOL!!!

  8. jose flores
    November 11, 2019 at 18:41

    then else is exactly the same than say if not, thanks

  9. Alicia Frazier
    November 11, 2019 at 18:41

    Question: I am confused on the part where you stated that var youLikeMeat = False, you if statement was true. How was that so if the value for if you like meat was set to a value of false.

  10. Sam Gerrans
    November 11, 2019 at 18:41

    Excellent work. I'm really getting all this; not just the "what" but the "why".

  11. Michael Eugene Romero
    November 11, 2019 at 18:41

    //Life Motto
    if(sad()===True) {

  12. Vladimir Solovev
    November 11, 2019 at 18:41

    It's an old tutorial of yours but I'd still like thank you for it !

  13. Milena Cabrera
    November 11, 2019 at 18:41


  14. prakash pawar
    November 11, 2019 at 18:41

    Hey i am getting error while var youLikeMeat = true;
    If(youLikeMeat) { document.write("here is…"} I am not getting any output , i perfectly paired my html with js still nothing showing up in my chrome, is this is problem with sublime text ?

  15. iMindProduction
    November 11, 2019 at 18:41

    Hello The Net Ninja, i hope you still see this. i have a question in this lesson. when we are saying var youLikeMeat = true and then writing the if statement . if (youLikeMeat) { document.write ("Here's the Meat Menu"); } the question is where is the conditional here ? and how when we change the var value it can reads it without any conditional comparison ?

  16. Alexandru Curca
    November 11, 2019 at 18:41

    Sir, I love your videos and and I am really thankful for putting this online, I am trying to follow your exact steps so I also downloaded Brackets but I don't know why I get ESLint and JSLint errors for example " document.write can be a form of eval" or "document is not defined." Could you tell me how to deal with this? Much appreciated..

  17. Cool Tony
    November 11, 2019 at 18:41

    Thanks for the tutorial. TT

  18. TakiDDine boufedeche
    November 11, 2019 at 18:41

    I switch on the beginning of your videos multiply times only to hear the oooooooooaaaaa hhh

  19. Ken Truong
    November 11, 2019 at 18:41

    Finally the fun part. "IF you take a crap in public, you'll wind up in prison" LMAO that right there woke me the F up!

  20. Debashish Bairagi
    November 11, 2019 at 18:41

    Thanks these videos are really helpful. Keep the good work alive 😀

Leave A Comment

You must be logged in to post a comment.