Back
You can very well use the negative indexing in String.prototype.slice() function like:
var example = "javascript";console.log(example.slice(-6));
var example = "javascript";
console.log(example.slice(-6));
Or,
var example = "javascript";console.log(example.slice(0, -6));
console.log(example.slice(0, -6));
I hope this will help.
Want to become a Java Expert? Join Java Certification now!!
Want to know more about Java? Watch this video on Java Tutorial for Beginners | Java Programming:
31k questions
32.8k answers
501 comments
693 users