Skip to content

Latest commit

 

History

History
21 lines (17 loc) · 285 Bytes

File metadata and controls

21 lines (17 loc) · 285 Bytes

Sprendimo variantas naudojant if:

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

Sprendimo variantas su operatoriumi ?:

function min(a, b) {
  return a < b ? a : b;
}

P.S. Lygybės a == b atveju nesvarbu, ką grąžinti.