_.upperFirst([string=‘’])

_.upperFirst() 方法将字符串的第一个字符转换为大写。

参数

  • string (string): 要转换的字符串。

返回值

(string): 返回转换后的字符串。

示例

const result = _.upperFirst("hello");
console.log(result);
// => 'Hello'

在这个示例中,字符串 'hello' 的第一个字符被转换为大写,结果为 'Hello'