関数定義
const 定数名 = function() {
処理
};
const hello = function() {
console.log("こんにちは");
}
アロー関数
function ()
の代わりに () =>
const hello = () => {
console.log("こんにちは");
}
関数呼び出し
定数名();
const hello = function() {
console.log("こんにちは");
}
hello();
戻り値とその呼び出し
const sum = (a , b) => {
return a + b;
}
const price = sum(100 , 300);
console.log(price);
出力結果
400