Javascript string Flashcards
what does .includes mean
to check if a substring is present inside a string
to know if a string starts or ends with a particular substring
startsWith() and endsWith()
explain indexOf and also its parameter
indexOf is a way to know the value of a beginning value of a string.
The substring that you want to search for, and an optional parameter that specifies the starting point of the search.
if indexOf is not in a string it will return
-1
how to a specific index of a multiple string in an array using index of
you will have to check the value you want to get the index of, then find add a position
You can access a specific character in a string by using
the square brackets syntax []
let name = “bradjames”
what is name[name.length-2]
E
What does .at does
It reads the character of a string at a certain index
.at() and square brackets syntax
they can find the character of a string at a certain index.
difference between .at() and square brackets syntax
the .at() can return the negative index of a string white the square returns undefined.
What is a substring
A substring is a part or a portion of a string
how many parameters does a substring has
2
how do the parameters work in a string
the first index you want to start from then, the first index you want it to start ignoring from.
what is the method for substring
.substring(indexStart, indexEnd)
what happens if indexEnd is not given?
it takes the rest of the length