首页 > 解决方案 > 用于初始化对象的 node.js 中的意外令牌 =

问题描述

我想在 node.js javascript 中使用一个对象将 Telnet 命令和选项映射到它的整数值:

MudSocket = class MudSocket extends TelnetSocket {

    tel = { opt2num: 
        ^ here is the error "unexpected Token"
        { IAC: "255",
          DONT: "254", // and so on
        },}

Visual Studio 代码编辑器没有显示任何错误,我尝试了 :, : Object (Error:only valid for typescript) 和 this.(Error: Unexpected Token again for this) 的前缀。

标签: javascriptnode.js

解决方案


推荐阅读