Are functions in JavaScript tail-call optimized?

后端 未结 3 1899
慢半拍i
慢半拍i 2020-11-27 14:12

I have been trying to understand Tail call optimization in context of JavaScript and have written the below recursive and tail-recursive methods for facto

3条回答
  •  执笔经年
    2020-11-27 14:44

    In theory yes. As the other answer states.

    In practice though, as of July 2017, No. Only Safari supports it.

    Javascript ES6 (ES2015) compatability: https://kangax.github.io/compat-table/es6/

提交回复
热议问题