Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

js string slice last n elements

const str = 'ECMAScript 2015';
const n = 4;
console.log(str.slice(-n));
// Output: 2015
Source by www.techiedelight.com #
 
PREVIOUS NEXT
Tagged: #js #string #slice #elements
ADD COMMENT
Topic
Name
8+7 =