1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| let me = null const timeAxis = ['1991', '2013', '2016', '2017', 'today'] const person = function(name, sex) { return { name: name, sex: sex } }
timeAxis.map(year => { if (year === '1991') { me = new person('mcdowell', 'male') } if (year === '2013') { me.college = '邯郸学院' } if (year === '2016') { me.job = 'coder' me.skills = ['html', 'css', 'js', 'JQ'] } if (year === '2017') { me.skills = [...me.skills, 'react', 'vue'] } })
console.log(me, '个人简介')
|