Tutorials
Start Learning
Learn HTML
Learn CSS
Learn JavaScript
TUTORIALS
THE WORLD'S LARGEST WEB DEVELOPER SITE
Exercise:
Use a conditional (ternary) operator for this exercise: If the variable firstName is equal to "John", the value of the variable result should be "Hello John!", otherwise the value of result should be "You're not John!".
Hint
Syntax hint: (condition) ? value1:value2;
Check Your Code
Show Answer
Hide Answer
First Name:
Check Name
First Name:
Check Name
Top Tutorials
HTML Tutorial
CSS Tutorial
JavaScript Tutorial
Top References
HTML Reference
CSS Reference
JavaScript Reference
Top Examples
HTML Examples
CSS Examples
JavaScript Examples
Web Certificates
HTML Certificate
CSS Certificate
JavaScript Certificate