Answers for "How does ternary operator work?"

45

ternary operator

(condition) ? (if true, do this) : (otherwise, do this)
Posted by: Guest on May-14-2020
0

How does ternary operator work?

const num1 = 3;
const num2 = 3;
num1 == num2 ? console.log('true') : console.log('flase');
//Expected output: true
Posted by: Guest on September-12-2021
1

ternary operator

if ($scope.SearchSalesOrderAndCompanyName !== undefined && $scope.SearchSalesOrderAndCompanyName != null ) {
            SearchCriteria += " AND [SalesOrderNo] LIKE '%" + $scope.SearchSalesOrderAndCompanyName + "%' OR ([SO].[CompanyNameOnBill] LIKE '%" + $scope.SearchSalesOrderAndCompanyName + "%')";
        }
        if ($scope.FromDate !== undefined && $scope.FromDate !=null) {
            SearchCriteria += " AND [SO].[SalesOrderDate] LIKE '%" + $scope.FromDate + "%'";
        }
Posted by: Guest on January-06-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language