Preview:
const isBigger = (a, b) => a > b
console.log('Is 2 bigger than 3?', isBigger(2, 3))

// How would you write this with the least amount of characters
function Add22andReturn(num) {
  let sum = 0
  sum = num + 22
  return sum
}

// Version 1
const Add22andReturn = (num) => {
  let sum = 0
  sum = num + 22
  return sum
}

// Version 2
const Add22andReturn = (num) => {
  let sum = 0
  sum = num + 22
  return sum
}

// Version 3
const Add22andReturn = (num) => {
  return num + 22
}

// Version 4
const Add22andReturn = (num) =>
  num +
  (22)[
    // Doing it on an array
    (1, 2, 3, 4, 5)
  ].map((num) => num + 22)
downloadDownload PNG downloadDownload JPEG downloadDownload SVG

Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!

Click to optimize width for Twitter