0

我在我的代码中使用断言,这里是示例:

this.getNewLinkId = function() {
    var newLinkId = this.links.length + 1;
    console.assert(this.getLink(newLinkId).length === 0, 'Generated ID is already present within links!');
    return newLinkId;
};

但是由于它们,代码可能会稍微难以阅读。有没有办法为assert函数指定语法高亮?例如,让他们的颜色像评论一样?

4

1 回答 1

0

据我所知,你不能在NB中做到这一点。也许战略换行可能对您有所帮助?

例如

this.getNewLinkId = function() {
    var newLinkId = this.links.length + 1;
    console.assert(this.getLink(newLinkId).length === 0, 
                   'Generated ID is already present within links!');
    return newLinkId;
};
于 2013-10-20T23:34:19.973 回答