Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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));
 
PREVIOUS NEXT
Tagged: #Use #Multiple #Conditional #Ternary #Operators #Javascript
ADD COMMENT
Topic
Name
4+8 =