+ 5
uppercase fist letter in a object (JS)
how do you uppercase the first letter in a javascript object? example let k = name: "ken", job: "digging", age: 80} ; to let k = name: "Ken", job: "Digging", age: 80} ;
3 ответов
+ 11
by iterating the keys and re-assigning string values however you want
* can probably do a much better code than this,
just an example of a possible implementation
https://code.sololearn.com/WNOE9is18K1v/?ref=app
+ 5
k.name = k.name.charAt(0).toUpperCase() + k.name.substr(1);
+ 2
Thanks for the help fellows