0
我有函數,其中我通過另外2個函數作爲參數,是這樣的:如何原型函數在diferent方面
DoSomething的(FUNC1,FUNC2)
我需要的是原型在其他方面的FUNC1當功能正在導出時。
例如我有2個diferent文件:
在第一個我導出,接收2層參數的功能的功能:前面說過
module.exports = (func1, func2) => {
}
在第二i傳遞參數等的doSomething (func1的,FUNC2)
i中的module.exports內如何原型的方式了toString我可以有這樣的功能1的輸出:
/* FUNC1()*/FUNC2()
我想是這樣的:
module.exports = (func1, func2) => {
func1.prototype.toString = function() {
const comment = `/* ${(_.toString(func1))} */ \n`;
return comment;
};
};
結果是沒有/ * * /任何與此幫助的FUNC1?
'結果是'你是如何得到這個結果的? –
是否要通過重寫toString方法來打印函數1代碼? – QuestionAndAnswer
我想通過原型功能1打印函數1中的函數2 –