Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
在 Javascript 中有typeof variable一个返回的字符串:数字、字符串、数组、对象。
typeof variable
我可以在 Ti-Nspire 中运行类似的函数来判断变量是数字、字符串还是矩阵?
是的,gettype(var)函数将返回带有变量类型的字符串("LIST", "MAT", "EXPR", "NUM", "STR", 或"NONE")
gettype(var)
"LIST"
"MAT"
"EXPR"
"NUM"
"STR"
"NONE"
不,但是如果您举例说明您为什么要这样做,那么有人可能会帮助您。
编辑:语言的更新添加了一个解决 OP 问题的功能,使这个答案过时了。