how to make a function
function myFunction(){
console.log('hi')
}
myFunction()
how to make a function
function myFunction(){
console.log('hi')
}
myFunction()
function
function factorial(n) {
if (n == 0) {
return 1;
} else {
return factorial(n - 1) * n;
}
}
function
function linearSearch(value, list) {
let found = false;
let position = -1;
let index = 0;
while(!found && index < list.length) {
if(list[index] == value) {
found = true;
position = index;
} else {
index += 1;
}
}
return position;
}
basic function example
function myFunction(a, b) {
return a * b;
}
Function example
// Define a function that prints a stringfunction welcomeMessage() { console.log('Welcome to JavaScript');}// Call the functionwelcomeMessage();
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us