0

I'm trying to convert an Object to String in JavaScript to do some String Manipulation. This is my code:

   var userName=String(userInfo.email);//regular email like [email protected]
   var atIndex=userName.indexof("@");

I got the following error:

TypeError: Object [email protected] has no method 'indexof'

What I'm doing wrong?

Thanks,

2 Answers 2

8

indexOf

Capital O is important.

Sign up to request clarification or add additional context in comments.

Comments

3

The 'O' should be a capital. Are you sure you got that right?

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.