次のことを考慮してください。
function(){
function getRate(source, scope) {
var dateValue = $("Date", source).text() || "";
if (!dateValue) {
return null;
}
var d = new Date();
var dailyPrice = $("DailyPrice", source).text() || "";
var weeklyPrice = $("WeeklyPrice", source).text() || "";
var monthlyPrice = $("MonthlyPrice", source).text() || "";
var isAvailable = $("IsAvailable", source).text() === "1";
var minimumStay = Number($("MinimumStay", source).text());
return {
date: new Date(dateValue),
dailyPrice: dailyPrice,
weeklyPrice: weeklyPrice,
monthlyPrice: monthlyPrice,
reserved: !isAvailable,
minimumStay: minimumStay
};
}
return {
getRates: function(xml){
return getRates(xml);
},
getAllRates: function(source, scope){
return new getRate();
},
};
}
この関数の外からdailyPriceを取得するにはどうすればよいですか
var getitall = getAllRates();
デバッガーで実行すると、関数に到達しますが、常に値が null として返されます。なぜ?