SOURCE


const sentenceCombining = ()=>{
    let subject = ['李奶奶','我','老师']

    let twoSubject = ['李奶奶和我','我和李奶奶','老师和我','我和老师','李奶奶和老师','老师和李奶奶']

    let threeSubject = ['我和李奶奶和老师','我和老师和李奶奶','李奶奶和我和老师','李奶奶和老师和我','老师和我和李奶奶','老师和李奶奶和我']

    let verb = ['去超市','吃早餐','去吃早餐','去买菜','去超市吃早餐','去超市买菜','买菜']

    // 单个主语
    let single = []
    subject.forEach(i=>{
        verb.forEach(j=>{
            single.push(`${i+j}`)
        })
    })
    // 两个主语
    let double = []
    twoSubject.forEach(i=>{
        verb.forEach(j=>{
            double.push(`${i+j}`)
        })
    })
    
    // 三个主语
    let three = []
    threeSubject.forEach(i=>{
        verb.forEach(j=>{
            three.push(`${i+j}`)
        })
    })
    return [...single,...double,...three]
}
console.log(sentenceCombining())
console 命令行工具 X clear

                    
>
console