+ 2

First letter [Javascript] [solved]

How can I define the first letter of a word in JavaScript? Input: John Output: J

21st Nov 2018, 7:36 AM
Alexander R. Storr-Hansen
Alexander R. Storr-Hansen - avatar
2 Respostas
+ 1
var name = Alex document.write(name.charAt(0)); like this?
21st Nov 2018, 7:41 AM
Alexander R. Storr-Hansen
Alexander R. Storr-Hansen - avatar
0
i just tried it and it worked. Thanks a lot. ive been crazy looking for this. Thanks
21st Nov 2018, 7:45 AM
Alexander R. Storr-Hansen
Alexander R. Storr-Hansen - avatar