SOURCE

function brakets(n){
    let str= 1.0.toFixed(n).substr(2).replace(/0/g, '(')
    let result = []
    for(let i=0;i<n;i++){
    //      console.log(i)
        for(let j=1;j<i+1;j++){
          let amount = j
          let use = 1
    	    let _case = []
          console.log("j--->", j)
          for(let count=0;count<n;count++ ){
            use = use < amount ? use : amount
            // console.log('amount', amount)
            if(amount <= 0){
              _case.push("")
            }else{
              _case.push(str.substr(0, use))
            }
            
            amount -= use
           	use+=1
          }
          result.push(_case)
        }
        
					
    }	
	return result
}
console.log(brakets(3))
console 命令行工具 X clear

                    
>
console