Use ternary operator to check for equality.
function checkEqual(a, b) { return (a = b ? true : false ); } checkEqual(1, 2);