def trim_js_ext(filename):
    """
    If `filename` ends with .js, trims the extension off.

    >>> trim_js_ext('foo.js')
    'foo'
    >>> trim_js_ext('something_else.html')
    'something_else.html'

    """
    if filename.endswith('.js'):
        return filename[:-3]
    else:
        return filename