【发布时间】:2023-04-03 13:54:01
【问题描述】:
我正在处理 Avatar 组件,我想在其中获取第一个字符和空格后的字符并将结果提供给化身并显示全名的缩写版本,例如:-
var fullName = ahmed hosny;
//I am able to get the first character like this:-
fullName.charAt(0).toUpperCase() // this prints 'A'
我的问题是如何从 hosny 获得“H”?谢谢
【问题讨论】:
标签: javascript