我有一个大约 3000 行长的 javascript 代码。所有功能都在一个文件中。我需要知道是否有办法在同一个文件中包含一个函数。
例子:
function renderGameLayout()
这将包括所有布局设计。
现在稍后在代码中,我将在另一个函数中回调该函数?我试过:
function getGames()
{
// other js code here
$(document).ready(function()
{
renderGameLayout();
});
// other js code here
}
在另一个函数中,但这不起作用。有什么建议么?注意:我不想包含另一个 .js 文件,请不要这样做。