Syntax for referring to the second character of the first item in an array

let myArray = [“simon”, “fred”];

this will output simon
but I want to output ‘m’ (not the whole name).
what is the syntax?

Hi @fuell.python !

I would suggest looking into the split method

Hope that helps

Hi :slight_smile:
I am sure that would do it but is there not something like
let myArray = [“simon”, “fred”]

// 0 refers to 1st item and next zero to the first letter.
I know this doesn’t work but surely its just a comma or something??
Thanks again very much



My face goes a little red.

I tried everything but the obvious .
Have a lovely day.

1 Like

It’s ok.

My first suggestion added extra steps that weren’t really necessary :laughing:
But know you now about the split method :grinning:

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.