DEV Community

loading...

Discussion on: Daily Challenge #15 - Stop gninnipS My sdroW!

Collapse
prvnbist profile image
Praveen Bisht • Edited

JS/ES

const revWords = str => {
    return str
        .split(" ")
        .map(word => (word.length >= 5 ? [...word].reverse().join("") : word))
        .join(" ")
};