• jtrek@startrek.website
    link
    fedilink
    arrow-up
    3
    ·
    5 hours ago

    For counting letters in a word? That’s like a one line expression in Python or JavaScript (and other languages). JavaScript console is right there in your browser.

      • jtrek@startrek.website
        link
        fedilink
        arrow-up
        3
        ·
        edit-2
        2 hours ago
        
        const countOfT = (word) => word.split('').filter(i => i === 't').length
        countOfT('colonialism')
        0 
        
        countOfT('this is an example sentence')
        2 
        

        There’s probably a more elegant way to do it.