with bracket vs without bracket

Edit on GitHub

if brackets

Setup

function findMinNoBracket (a, b) {
    if (a < b) return a;
    else return b;
}

function findMinWithBracket(a, b) {
    if (a < b) {
        return a;
    } else {
        return b;
    }
}

Tests

  • with bracket

    console.log(findMinWithBracket(0,10));
  • without bracket

    console.log(findMinNoBracket(0, 10));