{"json_modified": "2016-09-19T12:04:37.831216", "uuid": "b7498963-2d38-4fe2-ab84-9fd885e9cd36", "title": "Making decisions in your code \u2014 conditionals", "url": "/en-US/docs/Learn/JavaScript/Building_blocks/conditionals", "tags": ["else", "Beginner", "Switch", "Learn", "Article", "CodingScripting", "conditions", "Conditionals", "JavaScript", "ternary", "beginner", "if"], "translations": [], "modified": "2016-09-19T12:04:37", "label": "Making decisions in your code \u2014 conditionals", "localization_tags": [], "locale": "en-US", "id": 192487, "last_edit": "2016-09-19T12:04:32", "summary": "In any programming language, code needs to make decisions and carry out actions accordingly depending on different inputs. For example, in a game, if the player's number of lives is 0, then it's game over. In a weather app, if it is being looked at in the morning, show a sunrise graphic; show stars and a moon if it is nighttime. In this article we'll explore how so-called conditional statements work in JavaScript.", "sections": [{"id": "Quick_Links", "title": null}, {"id": "You_can_have_it_on_one_condition..!", "title": "You can have it on one condition..!"}, {"id": "if_..._else_statements", "title": "if ... else statements"}, {"id": "Basic_if_..._else_syntax", "title": "Basic if ... else syntax"}, {"id": "A_real_example", "title": "A real example"}, {"id": "else_if", "title": "else if"}, {"id": "A_note_on_comparison_operators", "title": "A note on comparison operators"}, {"id": "Nesting_if_..._else", "title": "Nesting if ... else"}, {"id": "Logical_operators_AND_OR_and_NOT", "title": "Logical operators: AND, OR and NOT"}, {"id": "switch_statements", "title": "switch statements"}, {"id": "A_switch_example", "title": "A switch example"}, {"id": "Ternary_operator", "title": "Ternary operator"}, {"id": "Ternary_operator_example", "title": "Ternary operator example"}, {"id": "Active_learning_A_simple_calendar", "title": "Active learning: A simple calendar"}, {"id": "Playable_code", "title": "Playable code"}, {"id": "Active_learning_More_color_choices!", "title": "Active learning: More color choices!"}, {"id": "Playable_code_2", "title": "Playable code 2"}, {"id": "Conclusion", "title": "Conclusion"}, {"id": "See_also", "title": "See also"}], "slug": "Learn/JavaScript/Building_blocks/conditionals", "review_tags": ["technical", "editorial"]}