// str.slice(beginSlice[, endSlice])
var s1 = "method extracts a section of a string";
var s2 = s1.slice(8, -10); // s1 length - 10
document.write(s2 + "<br />");
var s2 = s1.slice(7, -10); // s1 length - 10
document.write(s2 + "<br />");
var s2 = s1.slice(7, -8); // s1 length - 8
document.write(s2 + "<br />");
var s2 = s1.slice(7, -6); // s1 length - 6
document.write(s2 + "<br />");
var s2 = s1.slice(7, -15); // s1 length - 15
document.write(s2 + "<br />");
/*
run:
xtracts a section o
extracts a section o
extracts a section of
extracts a section of a
extracts a sect
*/