티스토리 뷰

Backend/Typescript & Angular

함수

개발하는 후딘 2021. 8. 22. 23:56
728x90
반응형

함수블록

return 코드는 함수 종료를 의미함.

 

 

ES6

- JS 2015년도 버젼

- const, let 등도 해당됨.

 

[참고용] ES6 와 ES5(2015년 이전 자바스크립트) 비교하면서 어느부분이 달라졌는지를 보여준다.

 

ECMAScript 6: New Features: Overview and Comparison

Constants Constants Support for constants (also known as "immutable variables"), i.e., variables which cannot be re-assigned new content. Notice: this only makes the variable itself immutable, not its assigned content (for instance, in case the content is

es6-features.org

 

 

화살표 함수

// arrow function
const add = (a, b) => {
  return a+b;
}

const sum_result = add(1,2);
console.log(sum_result);

 

화살표함수는 리턴문 없이 바로 값을 리턴할 수 있다.

const add_2 = (a, b) => a + b;


console.log(add_2(1,2));

 

 

[참고] arrow function VS regular function 차이점

 

 

5 Differences Between Arrow and Regular Functions

The 5 must-know differences between arrow and regular functions in JavaScript.

dmitripavlutin.com

 

 

 

 

728x90
반응형
반응형
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/05   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함