Excuse the petty question, but this is really nagging me. I'm following the mozilla example: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice Can someone explain why this doesn't work:
<body>
<p id="test">
</p>
</body>
var url = "teststring";
document.getElementById("test").innerHTML = (url.split('').splice(2,0,"teststring").join(''));
jsFiddle: https://jsfiddle.net/uyk2p437/1/
splicenotsplit. (5min already passed)!splice()doesn't return the Array you've spliced, but the array you've removed. In your caseurl.split('').slice(2,2).join('')would do exactly the same