Javascript 咖啡脚本';对`未定义的'的赋值`

Javascript 咖啡脚本';对`未定义的'的赋值`,javascript,coffeescript,undefined,Javascript,Coffeescript,Undefined,查看此队列代码来源: 为什么CoffeeScript在JavaScript中编译=undefined为void 0 Queue.prototype.pullHead = function() { if (!this.isEmpty()) { return (function(_this) { return function(value) { _this.array[_this.head] = void 0; // <------ not undefi

查看此
队列
代码来源:

为什么CoffeeScript在JavaScript中编译
=undefined
void 0

Queue.prototype.pullHead = function() {
  if (!this.isEmpty()) {
    return (function(_this) {
      return function(value) {
        _this.array[_this.head] = void 0; // <------ not undefined, but `void 0`?
        _this.head += 1;
        return value;
      };
    })(this)(this.array[this.head]);
  }
};
Queue.prototype.pullHead=function(){
如果(!this.isEmpty()){
返回(函数_this){
返回函数(值){

_this.array[_this.head]=void 0;//void
运算符的值始终是
未定义的
。我不知道为什么Coffeescript会将
未定义的
转换为该值,除了它可能短了几个字符,并且不会出现
未定义的
只是一个符号而不是保留字的问题。

啊,谢谢@Pointy.我看了你的答案后做了这个例子-。
Queue.prototype.pullHead = function() {
  if (!this.isEmpty()) {
    return (function(_this) {
      return function(value) {
        _this.array[_this.head] = void 0; // <------ not undefined, but `void 0`?
        _this.head += 1;
        return value;
      };
    })(this)(this.array[this.head]);
  }
};