main.js
function getTryangle1(base, height) {
return base * height / 2;
}
console.log(`三角形の面積: ${getTryangle1(5, 2)}`);
var getTryangle2 = new Function('base', 'height', 'return base * height / 2;');
console.log(`三角形の面積: ${getTryangle2(5, 2)}`);
var getTryangle3 = function(base, height) {
return base * height / 2;
};
console.log(`三角形の面積: ${getTryangle3(5, 2)}`);
let getTryangle4 = (base, height) => {
return base * height / 2;
};
console.log(`三角形の面積: ${getTryangle4(5, 2)}`);