Javascript Gerundization

Ever needed to "gerudize" a word? No? I needed to today to convert links and button labels like "Save" and "Submit" into their gerund equivalents: "Saving" and "Submitting". I found a set of rules on how to convert a verb into a noun here, and put together a simple Javascript implementation. I might do a ColdFusion one later to match my Pluralize() and Singularize() utility functions.

function gerundize (word) {
    if ( word.match( /[^aeiou]e$/i ) ) {
        word = word.slice(0, word.length-1);
    } else if ( word.match( /[^aeiou][aeiou][^aeiou]$/i ) ) {
        word = word + word.slice(word.length-1, word.length);

    return word + 'ing';

And the test code:

document.write('<br />');
document.write('<br />');
document.write('<br />');
document.write('<br />');
document.write('<br />');
document.write('<br />');

Jon Hartmann, July 2011

I'm Jon Hartmann and I'm a Javascript fanatic, UX/UI evangelist and former ColdFusion master. I blog about mysterious error messages, user interface design questions, and all things baffling and irksome about programming for the web.

Learn more about me.

Post a job. Find one.

Interested in becoming a sponsor? Contact me.