wiki/content/20201006111125-javascript_function_declerations.md

493 B

date id title
2020-10-06 0e8d8e26-e36d-48b6-a333-9c0fbd07b7b0 JavaScript function declarations
const square = function(x) {
    return x * x;
}

console.log(square(12))
const makeNoise = function() {
    console.log("Pling!")
}

makeNoise()
const power = function(base, exponent) {
  let result = 1;
  for (let count = 0; count < exponent; count++) {
    result *= base;
  }
  return result;
};

console.log(power(2, 10))