Sign in Go Pro

Beginning JavaScript for React Native

If, Else and the Ternary Operator

 
Autoplay

Up next

Previous

About

Basic branching is done with if, else if and else statements. You can also shorten branching logic by using the ternary operator - though it can sometimes lead to long lines of code that are complicated and hard to read.

It's also important to know the 6 values in JavaScript that evaluate to false:

  • false
  • 0
  • null
  • undefined
  • NaN
  • ""

Summary of Content:

  • Defining and using the basic if statement
  • Values in JavaScript that evaluate to false
  • Using else
  • Complex branching with else if
  • Short hand branching with the ternary operator

Instructor

Links

Comments

There are no comments on this lesson, start the conversation below ...

>
You need to go PRO to post comments.

Lessons in Beginning JavaScript for React Native