DEV Community

loading...

Discussion on: Daily Challenge #1 - String Peeler

Collapse
powerc9000 profile image
Clay Murray • Edited

Let's just go wild

(someString) => {
   switch(someString.length){
   case 0:
   case 1:
   case 2:
       return null;
   default:
       const arr = someString.split("")
       arr.pop();
       arr.reverse();
       arr.pop();
       arr.reverse();
       return arr.join("")
   }
}

Why not?

Collapse
aybee5 profile image
Ibrahim Abdullahi Aliyu

This is indeed wild