If/else statements in JavaScript are used to direct code to make decisions. Before we learned about the JavaScript code, we went through the swim lanes, where we used a similar if/else method to visualize different scenarios. Like the functions in JavaScript, the if/else statements are also often used and popular. Decisions that are made are known as conditional statements, and those decisions are made based on if something is true or false. To receive a desirable result from JavaScript code, we use conditional operators. Conditional operators can be used to compare two or more things and receive a true or false answer. For conditional operators, we use different variations of = !&I symbols provided in our book. These statements can be just simple ones as well as very complex ones. More complex expressions can be written with variables, functions, raw values arranged by conditional operators. Eventually we will still get back the true or false result.
Leave a Reply
You must be logged in to post a comment.