1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
let slogan = {
lastSentance: '牛年掘金沸点游',
nextSentance: '成为大佬不用愁',
summary: '街溜子'
}
function becomeBoss(slogan, way, action) {
if (way === 'juejin' && action === 'execute') {
format(slogan);
} else {
console.log('快上掘金!');
}
}
function format({ lastSentance, nextSentance, summary }) {
console.log(' ' + summary);
(lastSentance + nextSentance).split('').forEach((item, index, arr) => {
if (index < lastSentance.length) {
console.log(item + ' ' + arr[index + 7] + '\n');
}
})
}
becomeBoss(slogan, 'juejin', 'execute');
|