I have been using a ternary operator in JavaScript to modify the value of an object based on user input. I have the following code, which runs as it should:
Yes, you can use multiple condition in Ternary Operator. Hope this will help you.
var x=20; var y = x<13 ? "Child" : x<20 ? "Teenage" : x<30 ? "Twenties" : "Old people"; console.log(y);