var my_str="Welcome to www.plus2net.com";
The above code will display Welcome. We can start the slice from by living last 7 characters of the string by using negative number as p2. Let us remove last 7 characters of the string by using negative number as -7. Here is the code.
var my_str="Welcome to www.plus2net.com"
The output of the above code will be Welcome to www.plus2 , you can note that the last 7 characters of the main string is removed ( sliced ).