它来自if语句,他们使用es6但从未见过'/#'。任何人都在意解释。 (注意从堆栈流中删除反引号)
以下是代码片段: https://codedump.io/share/LPW9jWNDJZwl/1/weird-javascript 如果它可以提供帮助,那么这是package.json:https://codedump.io/share/HlvwlcmeiPW9/1/packagejson
// Flash around where you have just spawned
if (`/#${this.socket.id}` === player.id &&
player.moveCounter <= ClientConfig.TURNS_TO_FLASH_AFTER_SPAWN &&
player.moveCounter % 2 === 0) {
this.canvasView.drawSquareAround(player.segments[0], ClientConfig.SPAWN_FLASH_COLOR);
}
if (player.base64Image) {
this.canvasView.drawImages(player.segments, player.base64Image);
} else {
this.canvasView.drawSquares(player.segments, player.color);
}
}
答案 0 :(得分:-1)