Js remove after character

Javascript substring() method with indexof()

<script>
var str = '/snippets/data?url=BkNlG&type=add';
str = str.substring(0, str.indexOf('?'));
document.write(str);

// str.substring(start, end)
</script>

Related Sourcecode

More Sourcecode

×
Google login
SignUp with Email
X