강의

멘토링

커뮤니티

Inflearn Community Q&A

hwgiwh2715990's profile image
hwgiwh2715990

asked

Functional Programming and JavaScript ES6+ Applications

Multiplication Table of Memories

재귀는 어떻게 표현할 수 있을까요?

Written on

·

305

0

함수형으로 연습을 많이 하고 있는데 재귀는 어떻게 표현해야 하는지 잘 모르겠습니다..

예를들면

  const breadcrumb = () => {
    let path = "";
    (function recur(file) {
      path = "-" + file.getTitle() + path;
      if (file.parent) recur(file.parent);
    })(file);
    path = path.slice(1);
    return path;
  };

이런 코드가 있다고 하면 어떻게 함수형으로 작성할 수 있을까욤..?

함수형-프로그래밍javascript

Answer 1

1

mduniv님의 프로필 이미지
mduniv
Instructor

재귀를 쓰는 것도 좋고, 

이런것도 좋아요 

https://github.com/marpple/FxJS/blob/master/API.md#stoppable

jjang9님의 프로필 이미지
jjang9
Questioner

감사합니다~

hwgiwh2715990's profile image
hwgiwh2715990

asked

Ask a question