Function JavaScript
Function JavaScript
Disusun oleh :
Fika Baraka
11220930000090
Defining a Function
// function body
Calling a Function
functionName(argument1, argument2);
Returning a Value
function add(a, b) {
return a + b;
}
Function Parameters
function greet(name) {
console.log(`Hello, ${name}!`);
Function Arguments
Function arguments are the values that are passed to the function when
it is called. Arguments are listed in the parentheses of the function call,
separated by commas.
function add(a, b) {
return a + b;
Default Parameters
console.log(`Hello, ${name}!`);
Arrow Functions
Conclusion