Can I use function(e) twice or more in the same file?



Is it okay to use the same function in the same file twice or more

    document.getElementById('one').onlick = function test(e) 
    {
        var key = e.which;
        if(key === 13)
        {
            document.getElementById('two').click();
            return true;  
        }
    }

The other one is

    document.getElementById('elem').onlick = function test(e)
    { 
        document.getElementById('divtext').innerHTML=''; 
        e.preventDefault();   
        x--;
    }

Answer

function (e) is an anonymous function, you can have as many as you like.



Source: stackoverflow