Answers for "VueJS - getting the last element of a split string array"

0

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
Posted by: Guest on October-19-2021

Code answers related to "VueJS - getting the last element of a split string array"

Code answers related to "Javascript"

Browse Popular Code Answers by Language