Ternary Operator – Beau teaches JavaScript



The ternary operator, or conditional operator, takes three arguments and is basically a shortened way of writing an if-else statement.

Code:
🔗 http://codepen.io/beaucarnes/pen/oBbegb?editors=0012

More info:
🔗 https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Conditional_Operator

Beau Carnes on Twitter: https://twitter.com/carnesbeau

⭐JavaScript Playlists⭐
▶JavaScript Basics: https://www.youtube.com/playlist?list=PLWKjhJtqVAbk2qRZtWSzCIN38JC_NdhW5
▶ES6: https://www.youtube.com/playlist?list=PLWKjhJtqVAbljtmmeS0c-CEl2LdE-eR_F
▶Design Patterns: https://www.youtube.com/playlist?list=PLWKjhJtqVAbnZtkAI3BqcYxKnfWn_C704
▶Data Structures and Algorithms: https://www.youtube.com/playlist?list=PLWKjhJtqVAbkso-IbgiiP48n-O-JQA9PJ
▶Clean Code: https://www.youtube.com/playlist?list=PLWKjhJtqVAbkK24EaPurzMq0-kw5U9pJh


We’re busy people who learn to code, then practice by building projects for nonprofits. Learn Full-stack JavaScript, build a portfolio, and get great references with our open source community.

Join our community at https://freecodecamp.com
Follow us on twitter: https://twitter.com/freecodecamp
Like us on Facebook: https://www.facebook.com/freecodecamp
Follow Quincy on Quora: https://www.quora.com/Quincy-Larson

source

This Post Has 27 Comments

  1. MD-CODE

    Emotional Shahada! Brother Accepts Islam!

    https://www.youtube.com/watch?v=hvQ9biPlbos

    LGBT Students Question Purpose of Life

    https://youtu.be/E-KW9tUETN4

    Will She Accept Islam? David Wood's Gift to Islam

    https://youtu.be/iadevN2Zcqw

    Japanese Sister Embraces Islam

    https://youtu.be/9GOCsztZ7vI

    Mexican Sister Accepts Islam –

    https://youtu.be/Ko4q5dWEqdo

    Baptist Christian Finds the Truth

    https://youtu.be/7DUTk0P2lyo

    Is Jesus the Master of Muhammad – Surprise Ending

    https://youtu.be/Jxs1UZjEyPs

  2. Martin Muthie

    I had a ternary operator quiz that was embedded in another ternary operator and couldn't figure out what was happening. Until I met Beau. Thanks a lot.

  3. Bones Muhroni

    anyone else freaked out at how quickly he typed "You are an adult" and "You are a kid"?

  4. Akheli Kancha

    what is the difference between ternary operator and if/else statement? which one is faster, suitable and apprioripate in which situation?? can you explain. thank you in advance.

  5. Human Evolution

    Nested ternaries are wak yo. At that point we should be looking at switch statements. Right? Still learning…

  6. hey man

    can anyone tell what is meant by three operand ?

  7. Darnell G

    I am using Codecademy Pro and this was a bit confusing in the lesson. This video explains it absolutely perfect. I understand the syntax and how it works. Thank you!

  8. Cj Hunt

    This helped me a lot. Thanks Beau!

  9. •Sunny•

    in 4 minutes you explained everything. wooow Thank you

  10. lycan

    why fcc videos so little views? should have at least 50k views in my book

  11. lycan

    that thumbnail is hilarious lol

  12. ahmed ali

    😘😘😘😘😘😘😘😘😘😘😘

  13. nice video what if firstcheck = true and secondcheck = true please explain

Leave a Reply