logo CodeStepByStep logo

marshallMathers

Language/Type: JavaScript string

Given the following variable declarations:

// index       0123456789012345678901234
let s1   = "Snoop Dogg";
let s2   = "Marshall 'Eminem' Mathers";
let s3   = s2.substring(18);
let book = "Art & Science of JavaScript";

Give the results of the following expressions. Make sure to indicate a value of the proper type (e.g. strings in " " quotes).

s1.length
s2.length
s1.indexOf("o")
s2.indexOf("x")
s1.substring(6, 9)
s2.substring(21)
book.substring(6, 12)
s3.toLowerCase()

You must log in before you can solve this problem.

Log In

Need help?

Stuck on an exercise? Contact your TA or instructor.

If something seems wrong with our site, please

Is there a problem? Contact us.