更新时间:2023-09-06 22:15:28
调用对象以获取键值对后,可以使用[]
:
You can use []
after calling the object to get the key value pair:
GardinerToUnicodeCodePoint[userInput]
将您的代码更改为:
var userInput = $("#userInput").val; /*for example 'A1'*/
if (userInput in GardinerToUnicodeCodePoint) {
alert(GardinerToUnicodeCodePoint[userInput]);
} else {
alert("No code found!");
}
请参阅jsfiddle: https://jsfiddle.net/wy70s3gj/
See jsfiddle: https://jsfiddle.net/wy70s3gj/