JavaScript – Ternary Operator

Following is syntax of ternary operator in JavaScript. test?expression1:expression2 Example: <html xmlns=”http://www.w3.org/1999/xhtml”> <head> <title>Ternary Operator</title> </head> <body> <p id=”demo”> </p> <script type=”text/javascript”> var ele = document.getElementById(“demo”); Continue reading »