DEV Community

loading...

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);
};
Forem Open with the Forem app