JS function basics

PHOTO EMBED

Sun Feb 19 2023 12:16:18 GMT+0000 (Coordinated Universal Time)

Saved by @dariab82 #javascript

function sayHello() {
  console.log("Hello World");
}

sayHello();

function add(num1, num2) {
  console.log(num1 + num2);
}

add(5, 10);

function substract(num1, num2) {
  return num1 - num2;

  console.log("After the return"); // it won't be logged because it's after return
}

const result = substract(10, 2);

console.log(result, substract(20, 5));
content_copyCOPY