The Wayback Machine - https://web.archive.org/web/20220123041411/https://www.geeksforgeeks.org/web-technologies-questions-javascript-course-quiz-2-question-8/
Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

Web technologies Questions | JavaScript Course Quiz 2 | Question 8

  • Last Updated : 10 May, 2019

What will be the output of the following code?




<script>
 let age = 20;
 let result = age>18 ? 'Great' : 'Not so great';
 document.write(result);
</script>

(A) Great
(B) Not so great
(C) true
(D) None of the above


Answer: (A)

Explanation: ?: is a ternary operator which will return the value after ‘?’ if true else it will return the value after ‘:’.

Quiz of this Question

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!