function declaration

wanni kim·2021년 4월 9일
0
post-thumbnail

함수 선언방법 3가지

function getTriangle(base, height) { //함수 선언식
  let triangleVolume = (base * height) / 2;
  return triangleVolume;
}

const getTriangle = function (base, height) { //함수 표현식
  let triangleVolume = (base * height) / 2;
  return triangleVolume;
}

const getTriangle = (base, height) => { //화살표 함수
  let triangleVolume = (base * height) / 2;
  return triangleVolume;
}

const getTrianle = (base, height) => (base * height) / 2; //생략된 화살표 함수
profile
Move for myself not for the others

0개의 댓글