Java Script commands Flashcards
1
Q
add embedded string
A
${ }
2
Q
3 main variables
A
var
let
const
3
Q
Extracting part of a string
A
slice (start, end) - takes a slice
substring
substr - specifies length
4
Q
convert string to upper and lower case
A
toUpperCase()
toLowerCase()
5
Q
remove white space
A
trim()
6
Q
add padding to start of string
A
padStart(X,”Y”) - pad start with letter Y until it reaches X characters
7
Q
convert a number to a string
A
toString()
8
Q
case sensitive replace string
A
.replace(“this” , “that”) - replaces ‘this’ with ‘that’.
9
Q
case insensitive replace string
A
.repace(/this/i , “that)
10
Q
conditional
A
if (condition) {run this code }
else {run this code}
11
Q
A