[英]Single colon in JavaScript as a prefix to a variable (not object literal)
在Chrome中,您可以执行以下操作:
date = new Date();
然后在控制台中,您可以执行以下操作:
hour:date.getHours();
这个叫什么? 还有什么用呢?
我在以下代码中看到了这一点:
showDateTimePicker(date, callback) {
date = date || new Date();
var options = {
...this.props,
year:date.getFullYear(),
month:date.getMonth(),
day:date.getDate(),
hour:date.getHours(),
minute:date.getMinutes()
};
RCTDateTimePicker.showDateTimePicker(options, function (year, month, day, hour, minute) {
date.setFullYear(year);
date.setMonth(month);
date.setDate(day);
date.setHours(hour);
date.setMinutes(minute);
callback(date);
});
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.