Examples of ES6+ Features:
Function w/ No Parameters:
- classic version:
function sayHi() {
return "Hi there.";
}
- ES6+ version:
const sayHi = () => "Hi there.";
Function w/One Parameter:
function sayHi(userNm) {
return "Hi there " + userNm + ".";
}
const sayHi = userNm => "Hi there " + userNm + ".";
previous page
|