// 参考链接: http://www.dooccn.com/php7/#id/a64db6f8d4ca1f9f9a18daf1df28f12a
function recursion(str){
  var data = []
  var cloneStr = str
  
  for(var i = 0; i<str.length; i++){
    data.push(str[i])
    cloneStr = cloneStr.substring(1, cloneStr.length)
     
    recursion(cloneStr).forEach(function(item){
      data.push(str[i]+','+item)
    })
  }
  
  console.log('-',data)
  return data
}

var start = Date.now();
console.log(recursion('abc'))
var end = Date.now();

console.log(end - start); // ms 毫秒
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

This Pen doesn't use any external JavaScript resources.