Function Concept

      Functions guide computer reactions and produce results. The function’s syntax follows the rules of a selected programming language. As a category of code, the function orchestrates the user’s inputs and/or basic inquiries to produce a result. The key here is execution for a particular outcome. A function is what a computer does. Today, -as written on this date August 27, 2026- various devices including tablets, cell phones, laptops, desktops etc. are computers because they operate by the fundamental principles of a computer.

      Fundamentally, computer code as programmed directs the devices’ functionality. For example, it may compute results for math and/or compare various scenarios to provide answers. This programming starts as human readable code that is further encoded to be computer ready. The human readable code consists of various programming languages: hyper text markup (HTML), Javascript, C-Sharp (C#), Hypertext Preprocessor (PHP), etc.

      To illustrate, examples of JavaScript functions will be shown. Although many authors would say that this source code is human readable, it cannot really be fully comprehended unless specific operational steps performed by the computer’s brain are deciphered. (This requires a learned approach to study a specialized knowledge.) The illustrations are glimpse of what is going on. Hopefully, they will help guide understanding.

      Here are a few basic functions and the shorthand expression called the Arrow Function. (Some people may want to call the symbol, =>, used in the Arrow Function a rocket ship.) Examples for math functions follow:

JavaScript Functions

Demonstrated Functions include addition, subtraction and multipliction.
Traditonal format and Arrow format will be shown.

function add(a, b) { return a + b;}

The function is named add; it has 2 parameters which are the a and b; it performs the math of adding a and b.
The bracket expression returns the results of the addition operation.
In this case values passed to the function are 5 and 5; then a 50 and 50. These values become substituted values for a and b.
Programmers say the values (5 and 5 and 50 and 50) are arguments passed to be operated on. Hence the result is returned.

Arrow Functions

This example will shows the syntax of an Arrow Function, and how to use it.

Yes, a function where its keyword (function) is not written!!

INSTEAD, the symbol arrow head is used =>

  1. No, fuction keyword
  2. No, curly brackets {}
  3. No, return keyword

So, no fuction keyword, no return keyword, and no curly brackets.

function subtract(a, b) { return a - b;}

The function is named subtract; it has 2 parameters which are the a and b; it performs the math of subtracting a less b.
The bracket expression returns the results of the addition operation.
In this case values passed to the function are 25 and 5. These values become substituted values for a and b.
Programmers say the values (25 and 5) are arguments passed to be operated on. Hence the result is returned.

function multiply(a, b) { return a * b;}

The function is named multiply; it has 2 parameters which are the a and b; it performs the math of multplying a times b.
The bracket expression returns the results of the multipication operation.
In this case values passed to the function are 25 and 5. These values become substituted values for a and b.
Programmers say the values (25 and 5) are arguments passed to be operated on. Hence the result is returned.

ADDITIONAL EXPLANATION ◊◊◊ First Side Showing Execution, operation, of Code and
Second side showing the written code-- ◊◊◊

Subtracting 5 from 25 with arrow function:
const subtract2 = (a, b) => a - b;
Functions executes by simply calling the expression: subtract2(25, 5);

<h4 id="demo5"></h4>
<script>
const subtract2 = (a, b) => a - b;
document.getElementById("demo5").innerHTML =
"The result is " + subtract2(25, 5);
</script>