Logical statements without if in functions in JavaScript

Let's say we have a function with an if. Here it is:

function func(a, b) { if (a > b) { return true; } else { return false; } }

As you already know from the previous lessons, the if constructs that return Boolean values can be rewritten in a shortened form. Let's do that:

function func(a, b) { return a > b; }

Given the following function:

function func(a, b) { if (a == b) { return true; } else { return false; } }

Rewrite its code in an shortened form according to the theory studied.

Given the following function:

function func(a, b) { if (a != b) { return true; } else { return false; } }

Rewrite its code in an shortened form according to the theory studied.

Given the following function:

function func(a, b) { if (a + b >= 10) { return true; } else { return false; } }

Rewrite its code in an shortened form according to the theory studied.

Given the following function:

function func(num) { if (num >= 0) { return true; } else { return false; } }

Rewrite its code in an shortened form according to the theory studied.

enru