DEV Community

loading...

Discussion on: Daily Challenge #1 - String Peeler

Collapse
jenc profile image
jen chan • Edited

Handwrote my answer to practice:

const firstLast = (str) => {
const letters = [...str];

if (letters.length <=2){
return null;
}

let trimmed = letters.shift().pop();
return trimmed.join('');
}
Now to see if it works...

Forem Open with the Forem app