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.
为澄清而编辑:
function Num(str) { return str; }
当输入为 2^15 时返回
13
我想知道如何阻止它评估 str 并且只返回 2^15 而不是返回 13。
var string = "2^15"; // wrap in double quotes to treat it as a string
作为旁注,请避免将变量称为“字符串”,因为它是许多语言中的保留关键字并降低了可读性。