在Javascript中将变量传递给类方法

在Javascript中将变量传递给类方法,javascript,class,Javascript,Class,这是我第一次尝试使用类(或与类等效的Javascript) 使用以下代码,我得到错误:缺失(在Zeile 8中的函数参数之前) 这里的语法有错误吗?或者不可能将变量传递给“类方法”吗 不是 function tagConstructor.prototype.addTag = function 它是 function tagConstructor.prototype.addTag = function tagConstructor.prototype.addTag = function

这是我第一次尝试使用类(或与类等效的Javascript)

使用以下代码,我得到错误:
缺失(在Zeile 8中的函数参数之前)

这里的语法有错误吗?或者不可能将变量传递给“类方法”吗

不是

function tagConstructor.prototype.addTag = function
它是

function tagConstructor.prototype.addTag = function
tagConstructor.prototype.addTag = function