我正在尝试在 JavaScript 中将对象转换为字符串以进行一些字符串操作。这是我的代码:
var userName=String(userInfo.email);//regular email like user@email.com
var atIndex=userName.indexof("@");
我收到以下错误:
TypeError: Object feraeww23d4@wo3ewwito.co2mb has no method 'indexof'
我做错了什么?
谢谢
最佳答案
indexOf
大写O
很重要。
关于javascript - 将对象转换为字符串 Javascript 时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10252687/