DEV Community

Discussion on: Daily Challenge #1 - String Peeler

Collapse
 
hevivekm profile image
Vivek • Edited

Javascript

const stringPeeler = str => {
  if (undefined === str || null === str || 2 >= str) {
    throw new Error('Invalid String');
  }

  return str.slice(1, -1);
};
Enter fullscreen mode Exit fullscreen mode