Javascript string Flashcards

1
Q

what does .includes mean

A

to check if a substring is present inside a string

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

to know if a string starts or ends with a particular substring

A

startsWith() and endsWith()

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

explain indexOf and also its parameter

A

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.

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

if indexOf is not in a string it will return

A

-1

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

how to a specific index of a multiple string in an array using index of

A

you will have to check the value you want to get the index of, then find add a position

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

You can access a specific character in a string by using

A

the square brackets syntax []

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

let name = “bradjames”

what is name[name.length-2]

A

E

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

What does .at does

A

It reads the character of a string at a certain index

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

.at() and square brackets syntax

A

they can find the character of a string at a certain index.

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

difference between .at() and square brackets syntax

A

the .at() can return the negative index of a string white the square returns undefined.

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

What is a substring

A

A substring is a part or a portion of a string

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

how many parameters does a substring has

A

2

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

how do the parameters work in a string

A

the first index you want to start from then, the first index you want it to start ignoring from.

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

what is the method for substring

A

.substring(indexStart, indexEnd)

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

what happens if indexEnd is not given?

A

it takes the rest of the length

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

let myName = “hellojoy”

myName.substring(5)

A

joy

17
Q

what does template string interpolation means

A

This means you could write a variable in your template string, and get its value.

18
Q

how to make a string print step by step or multilines

A

by putting them in a template string