0

Given an array:

var top3Scientists = [ "Hawking", "Newton", "Tesla" ];

If I type top3Scientists[1], I get "Newton". How can I access single letters of an array element, i.e., "N"?

2
  • top3Sceintists[1].getCharAt(0)? Commented Feb 22, 2015 at 5:54
  • You using bracket notation on the string. Commented Feb 22, 2015 at 5:55

1 Answer 1

2
top3Sceintists[1] = "Newton"

then top3Sceintists[1][0] or top3Sceintists[1].getCharAt(0) will give you N

Working Fiddle

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

2 Comments

Unfortunately, it does not. Here's a screenshot =
Where is the screenshot?

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.