wayground logo

Free Printable Worksheets

Font size

S
M
L
XL
Worksheets

JavaScript String & Inbuilt functions

Total questions: 10

Worksheet time: 5mins

Name
Class
Date
1.

let string = "foo"

How to determine the length of the string?

a)

length(string)

b)

string.length

c)

string.length()

d)

all the above option

2.

let string = "The cat is black"

How to find the index/position of "cat" in the string

(a)  

3.

let string = "The black cat is black"

How to find the LAST index/position of "black" in the string

(a)  

4.

let string = "Milk, chocolate, cookies"

How to extract a new string "chocolate, cookies" from the first string

(a)  

5.

let string = "Milk, chocolate, cookies"

How to replace "chocolate" with "banana"?

(a)  

6.

let string = "Milk, chocolate, cookies"

How to figure out what character is on the 3rd position of the string?

(a)  

7.

let string = "Milk, chocolate, cookies"

How to convert the string to upper case?

(a)  

8.

let string = "Milk, chocolate, cookies"

How to convert the string to lower case?

(a)  

9.

let string = " Hello World! "

How to trim the whitespaces around "Hello World!" ?

(a)  

10.

let string = "a, b, c, 1, 2, 3"

How to convert this string into the array: ["a", "b", "c", "1", "2", "3"]?

(a)