8
JavaScriptの構造体
以前は、いくつかの関連する変数を格納する必要があるとき、クラスを作成していました。 function Item(id, speaker, country) { this.id = id; this.speaker = spkr; this.country = country; } var myItems = [ new Item(1, 'john', 'au'), new Item(2, 'mary', 'us') ]; しかし、これが良い習慣かどうか疑問に思っています。JavaScriptで構造体をシミュレートする他のより良い方法はありますか?
112
javascript
struct