Preview:
// with no parameter
const getNum = () => 2

// ES5 function
function getNum() {
  return 2
}

// with one parameter
// Function
const isOne = (num) => num == 1 // HW: === vs == in JavaScript, write a blog.

// Calling the function
console.log(isOne(12))

// Vinay

function isOne(num) {
  return num === 1 ? true : false
}

// Hiren
function isOne(num) {
  console.log(num)
}
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