如何确定变量是字符串还是JavaScript中的其他内容?
This is what works for me:
(这对我有效:)
if (typeof myVar === 'string' || myVar instanceof String) // it's a string else // it's something else
548k questions
547k answers
4 comments
86.3k users