我最近开始维护别人的JavaScript代码。我正在修复错误,添加功能,还试图整理代码并使其更加一致。
以前的开发人员使用了两种方法来声明函数,如果有背后的原因,我将无法解决。
两种方式是:
var functionOne = function() { // Some code }; function functionTwo() { // Some code }
使用这两种不同方法的原因是什么,每种方法的利弊是什么?有什么方法可以用另一种方法不能完成的吗?