I'm a beginner to UI5 and I couldn't find an answer to the following question:
Why in UI5 functions are declared this way:

and I can't declare it this way:

I couldn't find any JavaScript resource that shows the first picture function declaration . thanks
you can declare a function any way you wish, but usually, in sapui5 we extend some control and we write code inside it so when you declare a function inside a class or object right way to declare is
not