如何通过`if`构造获得结果?

时间:2017-01-31 00:29:43

标签: javascript

如何获得SELECT CAST (d.department_id AS NVARCHAR(100)), d.department_name, COUNT(e.Employee_ID) AS '# of employees', AVG(e.Salary) AS 'AveSalary' FROM employees e , departments d WHERE e.department_id = d.Department_ID GROUP BY d.Department_id, d.department_name UNION ALL SELECT e.first_name,e.Last_Name, e.job_id,e.Salary FROM employees e , departments d WHERE e.department_id = d.department_id; 构造的结果? 例如,在这种情况下,我需要真值if

->5

2 个答案:

答案 0 :(得分:0)

你可能意味着这样做:

function myFunction2() {
  if (2 < 4) {
    return 5;
  } else {
    return 6;
  }
}

阅读:return - JavaScript | MDN

答案 1 :(得分:0)

我认为您之后的语法只是使用the conditional ternary operator

function myFunction2() 
{
    return 2 < 4 ? 5 : 6;
}