Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

VueJS - getting the last element of a split string array

const str = "hello,how,are,you,today?"
const pieces = str.split(/[s,]+/)
const last = pieces[pieces.length - 1]

console.log({last})
 Run code snippet
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #VueJS #element #split #string #array
ADD COMMENT
Topic
Name
6+9 =