can’t we use string or any other data type in ternary

A ternary expression statement consists of three parts, a conditional (or state) and two ways to branch.

f = a ? b : c;

In JavaScript, b, and c could be functions and a the toggle control. f is the function of the instance in which this relationship is questioned.

If a is a string of some length then f will be function b; else, f will be function c


This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.