我不明白为什么变量在函数内部声明时表现得如此奇怪。
在first我用let变量b和c值10声明的函数中:
b = c = 10;
Run Code Online (Sandbox Code Playgroud)
在second我显示的函数中:
b + ", " + c
Run Code Online (Sandbox Code Playgroud)
这表明:
10, 10
Run Code Online (Sandbox Code Playgroud)同样在first函数中,我a用值10声明:
let a = b = c = 10;
Run Code Online (Sandbox Code Playgroud)
但是在second函数中它显示了一个错误:
找不到变量:
a
现在在first我d用值20声明的函数中:
var d = 20;
Run Code Online (Sandbox Code Playgroud)
但是在second函数中,它显示了与以前相同的错误,但使用了变量d:
找不到变量:
d
例子:
b = c = 10;
Run Code Online (Sandbox Code Playgroud)
例如,我有这个表情符号:
Run Code Online (Sandbox Code Playgroud)
...我想得到你的字符代码。我试过这个:
但是当使用String的fromCharCode方法时,我没有得到原始的表情符号:
var emoji = ""
var char_code = emoji.charCodeAt()
console.log(emoji,char_code)Run Code Online (Sandbox Code Playgroud)
如何从您的字符代码中获取原始表情符号?否则我怎样才能让你的实际字符代码在其中使用它String.fromCharCode?