我定义了一个变量,并给它分配了一个语法错误的函数。它抛出错误。现在,我无法将该变量用于任何事情,它总是说'抛出:引用错误:未定义变量'
> let bg = 'asasas-123d'
undefined
> let fd = bg.substring(indexOf('-')+1)
Thrown:
ReferenceError: indexOf is not defined
> let fd = bg.substring(bg.indexOf('-')+1)
Thrown:
SyntaxError: Identifier 'fd' has already been declared
> fd = bg.substring(bg.indexOf('-')+1)
Thrown:
ReferenceError: fd is not defined
> let fd = bg.substring(bg.indexOf('-')+1)
Thrown:
SyntaxError: Identifier 'fd' has already been declared
> fd = bg.substring(bg.indexOf('-')+1)
Thrown:
ReferenceError: fd is not defined
> fd
Thrown:
ReferenceError: fd is not defined
> console.log(fd);
Thrown:
ReferenceError: fd is not defined
只需重新启动终端并运行以下命令:
> let bg = 'asasas-123d'
> let fd = bg.substring(bg.indexOf("-") + 1))