Practice Practice Practice
Arrow function
Practice arrow function syntax by converting regular function declarations to arrow function expressions, refactoring arrow functions, and debugging arrow functions.
convert
function addFive(num) {
return 5 + num;
}
function divide(num1, num2) {
return num1/num2;
}
function printMyName() {
let myName = 'Ghadeer';
console.log(myName);
}
debug
const multiply = num1, num2 => console.log(num1 * num2);
const subtractFive = num =>
const diff = 5 - num;
console.log(diff);
const printName = name = function() {
console.log(name)
multiply(2,6);
subtractFive(4);
printName('Ghadeer');
Refactor
const multiplyByFive = (num) => {
return 5* num;
}
const printTenTimes = () => {
for (let i = 1; i <= 10; i++) {
console.log(i);
}
}
const add = (num1, num2) => {
console.log(num1 + num2);
}