查看我的代码
<html>
<body>
<script type="text/javascript">
var str="Visit Microsoft!";
document.write( str = str.replace("",'ss'));
</script>
</body>
</html>
输出为
ssVisit Microsoft!
为什么会这样?
最佳答案
这是正确的,因为每个字符串都以空字符串开头。请参阅下面的帖子了解更多信息:
关于Javascript String.replace() ,结果不明确,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9419748/