00:00:00 introduction
00:00:14 functions
00:01:57 arguments/parameters
00:04:40 return
00:06:35 example 1
00:07:33 example 2
00:09:30 example 3
00:11:45 conclusion
// function = A section of reusable code.
// Declare code once, use it whenever you want.
// Call the function to execute that code.
function happyBirthday(username, age){
console.log(`Happy birthday to you!`);
console.log(`Happy birthday to you!`);
console.log(`Happy birthday dear, ${username}`);
console.log(`Happy birthday to you!`);
console.log(`You are ${age} years old!`);
}
function add(x, y){
return x + y;
}
function subtract(x, y){
return x - y;
}
function multiply(x, y){
return x * y;
}
function divide(x, y){
return x / y;
}
function isEven(number){
return number % 2 === 0 ? true : false;
}
function isValidEmail(email){
return email.includes("@") ? true : false;
}
console.log(happyBirthday("BroCode", 25));
console.log(isValidEmail("Bro@fake.com"));
Ещё видео!