A High-level(no need to worry about stuff like memory management), Object-oriented(based on objects, for storing most kinds of data), Multi-paradigm(can be used to different styles of programming) Programming Language.
I am ${firstName} ${lastName} and ${year - birthYear} years old ${job}
// Function Expression
const calcAge2 = function(birthYear) {
return 2037 - birthYear;
}
// Arrow Function - one parameter
// No return statement
const calcAge3 = birthYear => 2037 - birthYear;
const age3 = calcAge3(1991);
console.log(age3); // 46
// Arrow Function - multiple parameters 1
// have to use return statement
const yearsUntilRetirement = birthYear => {
const age = 2037 - birthYear;
const retirement = 65 - age;
return retirement;
}
const retire = yearsUntilRetirement(1991);
console.log(retire); // 19
// Arrow Function - multiple parameters 2
// have to use return statement
const yearsUntilRetirement = (birthYear, firstName) => {
const age = 2037 - birthYear;
const retirement = 65 - age;
// return retirement;
return `${firstName} retires in ${retirement} years.`;
}