私はプロジェクトに取り組んでおり、現在 Javascript を学んでいます。現在、コンストラクターを使用してオブジェクトを作成し、それに属性を割り当て、後でこれらの属性を読み取って変更する方法を考えています。作成と割り当ての部分は正しくできたと思いますが、外部からオブジェクトの属性にアクセスできないようです。
function initialize() {
var testPlane = jet("9C3476", currentAirport, "Palma De Mallorca", "02:45", "Departed");
alert("Never get to this point: " + testPlane.id);
}
function jet(id, from, to, expected, status) {
this.id = id;
this.from = from;
this.to = to;
this.expected = expected;
this.status = status;
this.position = from;
alert("Id: "+ id + " From:" + from + " To: " + to + " Expected: " + expected + " Status: " + status);
this.marker = new google.maps.Marker({
position : this.position,
icon : img,
map : map,
});
}