answersLogoWhite

0

The location of a substring within a string in JavaScript can be found using the indexOf() method of the string type.

That method will return the placement of a string as a numerical index, starting from 0.

The method takes two arguments. The first is the substring you're looking for. In this case "e." The second argument is optional, and it's the "start" argument. If you define it, you define the index from which JavaScript will start looking for the substring. By default, this index is 0 (zero.)

If you want to find all of the occurrences of a string using this method, you have to write a loop. To see a working example of that, check out the JSFiddle in the related links.

I've also attached a good lesson on JavaScript strings in PDF.

User Avatar

Wiki User

13y ago

What else can I help you with?

Related Questions

How can I use the mini.split function to separate a string into an array of substrings in JavaScript?

To use the mini.split function in JavaScript to separate a string into an array of substrings, you need to call the split method on the string and provide the delimiter as an argument. This will split the string at each occurrence of the delimiter and return an array of substrings.


How can one replace words in JavaScript's String Object?

The JavaScript's String Object has a function that allows someone to replace words that occur within the string. This works if the form letter with a default reference of username is available.


At which decimal of pi does the earliest occurrence of the string 999999 begin?

762 is when the decimal of pi had the earliest occurrence of the string 999999. Pi has been represented by a Greek letter since the mid 19th century.


How do you check length of password using javascript?

Use the length property of string in javascript.


Write a JavaScript program showing string concatenation?

There isn't much to it:---alert("Hello " + "world!");---'alert' creates a popup, and the + does string concatenation.See related link for a Javascript tutorial.


What is the meaning behind a javascript split?

The javascript split method, split(), will alter a string to make it into an array of substrings. This is useful if you would like to store each substring from the original string seperately.


Function finds the occurrence of a given string in another string?

in C: strstr, declared in string.h


What is parseint in javascript?

it is used to convert the string value that we get from the users to integer data type


Write a c program using string concept enter a sting and replace the new string in to old string and find no of occurrence?

print c co com comp compu


What are JavaScript literal and what are its types?

A data value that appears directly in a statement Literals can be of several types. Some of them are: Number String Boolean


How do you use equals equals equals operator in javascript?

'1' will return false because one variable is an integer and the other is a string.


Where can one find more information about Javascript strings?

One can find more information about JavaScript strings from several places. One can look at the JavaScript website. One would also do well to look up JavaScript strings on Stack Overflow, which has many resources for answering questions about programming topics.