I am working on a javascript code where functions are defined in three different ways.
funtion f1(){}
Run Code Online (Sandbox Code Playgroud)
and second
var vaiable = f1(){}
Run Code Online (Sandbox Code Playgroud)
and third
window.f1 = function(){}
Run Code Online (Sandbox Code Playgroud)
I have read about the first two here but don't know about the last one.
Will there be a problem if I change the third one to the second one?
What are the pros and cons of third type?
Why it is used particularly?