Web technologies Questions | JavaScript Course Quiz 2 | Question 8
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
Last Updated :
10 May, 2019
Like Article
Save Article
Share your thoughts in the comments
Please Login to comment...