なぜこれがうまくいかないのか理解に苦しむ。問題はどこだ?これは、この関数に値を渡す正しい方法ですか?他の方法はありますか?
seqer.set_prefix = 'Q';
seqer.set_seq = 1000;
この方法でそれを行うことは可能ですか:
sequer.set_prefix('Q');
var serial_maker = function () {
var prefix = '';
var seq = 0;
return {
set_prefix: function (p) {
prefix = p;
},
set_seq: function (s) {
seq = s;
},
gensym: function () {
var result = prefix + seq;
seq += 1;
return result;
}
};
}();
var seqer = serial_maker();
seqer.set_prefix = 'Q'; // is this the right way to pass in values to this function, are there other ways? is it possible to write like this sequer.set_prefix('Q);
seqer.set_seq = 1000; // same here?
seqer.gensym()
;