multiple conditions in conditional operator js code example

Example 1: Use Multiple Conditional Ternary Operators Javascript

// Use Multiple Conditional Ternary Operators Javascript.


function checkSign(num) {

	return num > 0 ? "positive" : num < 0 ? "negative" : "zero";

}

console.log(checkSign(10));
console.log(checkSign(-10));
console.log(checkSign(0));

Example 2: multiple conditions in javascript

let str = "fuck it I don't care";

let results = []
let results[0] = str.includes("hello") || str.includes("hi") || str.includes("howdy");

console.log(results[0]);