Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

javascript string search second occurrence

const string = "XYZ 123 ABC 456 ABC 789 ABC";

function getPosition(string, subString, index) {
  return string.split(subString, index).join(subString).length;
}

console.log(
  getPosition(string, 'ABC', 2) // --> 16
)
Comment

PREVIOUS NEXT
Code Example
Javascript :: output in javascript 
Javascript :: js enums class 
Javascript :: js clone element 
Javascript :: express redirect 
Javascript :: laravel jquery csrf 
Javascript :: return only specific attributes when making query mongoose 
Javascript :: react addeventlistener useeffect 
Javascript :: react navigation header background color 
Javascript :: import file json angular 12 
Javascript :: how to take input in javascript in coding 
Javascript :: using map in useeffect 
Javascript :: jquery today date 
Javascript :: get public url as laravel asset() in jquery 
Javascript :: javascript origin url 
Javascript :: link on click jquery 
Javascript :: momentjs range 
Javascript :: when a form is subbmited jquery 
Javascript :: jquery select all checkboxes 
Javascript :: merge array within an array 
Javascript :: using .includes for an array of objects js 
Javascript :: get object key from value javascript 
Javascript :: js convert to fraction 
Javascript :: read json file into object javascript 
Javascript :: how to iterate over keys in object javascript 
Javascript :: ajax file upload from modal 
Javascript :: user api testing 
Javascript :: delay input javascript 
Javascript :: angular http put 
Javascript :: vowel 
Javascript :: change href without reloading page js 
ADD CONTENT
Topic
Content
Source link
Name
7+6 =