With the current Firefox version you can simply call FileUtils.File()
as a function and you will get the same result. However, this is an implementation detail - the documentation clearly says that FileUtils.File()
is a constructor and should be used as such, with the new
keyword. So while you can use it as a function, you cannot really rely on this behavior - it might stop working if the implementation changes in future. More importantly, logically this is a constructor that creates a new object, using it as such makes the code easier to understand.
FileUtils have to use new?
-
14-07-2023 - |
Domanda
With FileUtils, do we have to use the the new word before it?
var f = new FileUtils.File(mypath);
Can't we just do:
var f = FileUtils.File(mypath);
Soluzione
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow