Strings

Last Character of a string in JS.

Code
Diff
  • const lastChar=(s)=>s.slice(-1)
    
  • 1
    def last_char(str):
    
    2
      return str[-1]
    
    1+
    const lastChar=(s)=>s.slice(-1)