I saw in a javascript code written by a young guy this function
function foo(e:MouseEvent){
...
}
I want to know what does e:MouseEvent do?
'e:MouseEvent' is a named parameter with a type declaration in typescript. A colon is used in typescript parameters to bind a parameter to a specific type which, in this case, is type 'MouseEvent'.
e is often used as the parameter name for a javascript event. Given the type it's likely a function that responds to a click event.
You can read more details about the syntax for it under the 'Function Types' heading of TypeScript's official documentation: https://www.typescriptlang.org/docs/handbook/functions.html.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With