给字符串对象定义一个addPrefix函数,当传入一个字符串str时,他会返回新的带有指定前缀的字符串。比如console.log("world".addPrefix("hello"));//"helloworld"
<script>
String.prototype.addPrefix = function(str){
return str + this;
}
console.log('world'.addPrefix('hello'));//helloworld
</script>