DEV Community

loading...

Discussion on: Daily Challenge #1 - String Peeler

Collapse
gnsp profile image
Ganesh Prasad

const test = require ('./tester');

const f = str => str.length > 2 ? str.slice(1, -1) : null;
test (f, [
    {
        in: ['Dev'],
        out: 'e',
    },
    {
        in: ['GP'],
        out: null,
    },
    {
        in: ['hello'],
        out: 'ell'
    }
]);

[PASSED]  Case #1: e
[PASSED]  Case #2: null
[PASSED]  Case #3: ell

Forem Open with the Forem app