String_Methods Flashcards

1
Q

string.length

A

find length of string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

string[index]

A

Retrieving character from string

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

string.includes(“zilla”)

A

Testing if a string contains a substring (eg “zilla” in “mozilla” will retunr true)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

string.startsWith(“abc”)

A

Want to know whether string starts with specific substring (in this case “abc”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

string.endsWith(“abc”)

A

Want to know whether string end with a specific substring (in this case “abc”)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

string.indexOf()

A

Finding position of a substring in a string. Returns index of first occurrence of the substring. Return -1 if not present.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

string.slice(index, index)

A

extracts substring from a string. Only one index required if you want to extract all characters after a certain letter. 2 indexes required if you want from a certain index to another index.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

string.toLowerCase()

A

convert string to lowercase

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

string.toUpperCase()

A

convert string to uppercase

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

string.replace(“abc”, “def”)

A

first parameter is substring you want to replace, second parameter is what you want to replace substring with.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

string.replaceAll(“be”, “code”)

A

Replace all occurrences of “be” by “for”

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q
A
How well did you know this?
1
Not at all
2
3
4
5
Perfectly