'use strict';
function normalize(arr) { return arr.map(name => name.split("").reduce((x, y, index) => { if (index == 1) { x = x.toUpperCase(); } y = y.toLowerCase(); return x + y; })); } // 测试: if (normalize(['adam', 'LISA', 'barT']).toString() === ['Adam', 'Lisa', 'Bart'].toString()) { console.log('测试通过!'); } else { console.log('测试失败!'); }
Sign in to make a reply
格子