var canDrive = age > 16 ? 'yes' : 'no';
? : is called a ternary operator and acts just like an
else when used in an expression
Ternary operator (Conditional operator)
Do comment if you have any doubts and question on this tutorial.
Note: The All JS Examples codes are tested on the Safari browser (Version 12.0.2) and Chrome.
OS: macOS 10.14 Mojave
Code: HTML 5 Version
Degree in Computer Science and Engineer: App Developer and has multiple Programming languages experience. Enthusiasm for technology & like learning technical.