Functions in JavaScript are special built-in objects. Because their purpose is to interact with web components, they have properties and usages that are unique and different from common programming languages like Java/C++. There are different ways of coding JavaScript functions.
Let’s start with something familiar though. Regular functions are declared with a function
statement, and they are later called by name like standard functions in other common languages . They are useful when you want to group lines of code that have a single responsibility.
function multiply() {
var result = 3 * 4
console.log("3 multiplied by 4 is ", result)
}
multiply();
3 multiplied by 4 is 12
Read More