Reputation: 6291
See my code
<html>
<body>
<script type="text/javascript">
var str="Visit Microsoft!";
document.write( str = str.replace("",'ss'));
</script>
</body>
</html>
The output is
ssVisit Microsoft!
Why is it happening.?
Upvotes: 2
Views: 241
Reputation: 36
This is correct because every string begins with an empty string. See below post for more info:
Why does "abcd".StartsWith("") return true?
Upvotes: 2