Unsectioned

Preview this deck

How do you convert a number into a string?

Front

Star 0%
Star 0%
Star 0%
Star 0%
Star 0%

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Active users

2

All-time users

2

Favorites

0

Last updated

1 month ago

Date created

Feb 17, 2021

Cards (17)

Unsectioned

(6 cards)

How do you convert a number into a string?

Front

.toString()

Back

What to use when you want to know if a string begins with a value?

Front

.startsWith()

Back

How do you get rid of whitespace at the beginning and end of a string?

Front

.trim()

Back

Explain non-tagged template literals.

Front

Within a string, you can insert (interpolate) code into a placeholder. The placeholder syntax is to use ${ }, the browser will execute what's inside the braces. Could be a function, variable, expression, whatever.

 

Use backticks instead of quotes to indicate the string is a template variable.

Back

.substring() is weird and .slice() is better, why?

Front

.substring uses the end index to ignore when .slice use of the end index includes the last character

Back

What to use when you want to know if a string ends with a value?

Front

.endsWith()

Back

Array Methods

(10 cards)

With .includes(), if you use a from index of less than 0, what happens?

Front

It takes the string length and subtracts the fromIndex. So, a string length of 5 with a fromIndex of -1 will calculate to be [4]

Back

What would I use to see if a value is in a string?

Front

.incluldes()

Back

Add an item to the end of an array with?

Front

.push()

Back

What does .includes() return?

Front

Boolean

Back

is .includes() case sensitive?

Front

Yep

Back

If you mess up .includes() and put a fromIndex of greater than the string length, what happens?

Front

return is false

Back

What's the optional parameter in .includes()?

Front

The fromIndex.

Back

If you use a negative fromIndex on .includes() that is greater than the string length, what happens?

Front

Nothing, it just searches the whole string.

Back

What does .push() return?

Front

The array length.

Back

Does .includes() work only on strings?

Front

No, it works on all array-like objects.

Back

Objects

(1 card)

Object properties and methods are called differently, how so?

Front

You don't use the parenthesis on a property.

Back