JavaScript If...Else Statements Tutorial
HTML by nature is a linear language. It reads a document line by line from top to bottom and outputs the contents into a browser window following that linear fashion. JavaScript is much more dynamic. Regardless of its place within a document, the DOM can access and modify a document's flow, making it a rebel of all that HTML mark-up and its linear output stands for.
In JavaScript, the If...Else statements challenge the conventional process of how HTML is displayed because it offers an opportunity to create subroutines and therefore, options only limited by the imagination and scope of the JavaScript code.
If...Else Statements and Comparison Operators
The script example provided demonstrates how an If...Else statement with several conditions can return one of many choices. This is based on user-generated inputs.