What's the most readable way to write nested functions in javascript?

Viewed 184

Example this code I wrote doesn't seem as readable as it could be:

function getShortMessages(messages) {
    return messages.filter((messages) => {
        return messages.message.length < 50
    }).map((object) => {
        return object.message
    })
}
3 Answers
Related