RSRobince Studio

JavaScript Functions

A function is a named block of code you can run whenever you like. It can take parameters (inputs) and return a result.

function add(a, b) {
  return a + b
}
console.log(add(2, 3))  // 5
Try it yourself

Loading editor…