Console.log (e) output undefined

1. I have the following code in a js file:

var test = {
    test1(e){    
        console.log(e)
    }
}

2. Introduce this js, into html and call it as follows:

<script src="js/base.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
    test.test1()
</script>   

my goal is to output the contents of e in the console, but the console only outputs undefined

3. If you write directly to html, e has output, as shown in the following figure:

<script type="text/javascript">
    window.onload = function(e){
        console.log(e)
    }
</script>

clipboard.png

but not from external references, solve.

Mar.22,2021

change to window.onload = test.test1


you must inject events to have e, such as onload,click and other events


sibling event objects must have events

Menu