javascript find first occurrence in string

var copyright = 'site.com. All rights reserved. | Privacy Policy';
var copyright_cut = copyright.substring(0, copyright.indexOf('reserved')+8); // copyright_cut = 'site.com. All rights reserved'

Leave a Reply

Your email address will not be published. Required fields are marked *