function reverse1(input){
if(typeof input !== 'string'){
throw new Error('给我字符串啊')
}
var output = ''
for(var i = 0; i< input.length; i++){
output = input[i] + output
}
return output
}
function reverse2(input){
if(typeof input !== 'string'){ throw new Error('我只要字符串') }
return input.split('').reverse().join('')
}
var t1= new Date()
for(var i =0;i<100000;i++){
reverse1('sakjdlaskjdlaskjdaslkjdaslkjdaslkfjaslkfjaslf;kj')
}
console.log(new Date() - t1)
var t2= new Date()
for(var i =0;i<100000;i++){
reverse2('sakjdlaskjdlaskjdaslkjdaslkjdaslkfjaslkfjaslf;kj')
}
console.log(new Date() - t2)