WorksheetsJavaScript String & Inbuilt functions
Total questions: 10
Worksheet time: 5mins
let string = "foo"
How to determine the length of the string?
length(string)
string.length
string.length()
all the above option
let string = "The cat is black"
How to find the index/position of "cat" in the string
(a)
let string = "The black cat is black"
How to find the LAST index/position of "black" in the string
(a)
let string = "Milk, chocolate, cookies"
How to extract a new string "chocolate, cookies" from the first string
(a)
let string = "Milk, chocolate, cookies"
How to replace "chocolate" with "banana"?
(a)
let string = "Milk, chocolate, cookies"
How to figure out what character is on the 3rd position of the string?
(a)
let string = "Milk, chocolate, cookies"
How to convert the string to upper case?
(a)
let string = "Milk, chocolate, cookies"
How to convert the string to lower case?
(a)
let string = " Hello World! "
How to trim the whitespaces around "Hello World!" ?
(a)
let string = "a, b, c, 1, 2, 3"
How to convert this string into the array: ["a", "b", "c", "1", "2", "3"]?
(a)
