+ 1
How to make string letters uppercase?
Hi guys.How can i write a function that access the first and last letter of a string in an object and make the 2 letters uppercase
10 Answers
+ 3
Cedrich
See your mistakes. I have resolved.
https://code.sololearn.com/Wdpm7bFowXLx/?ref=app
+ 3
function upperCase(str) {
var last = str.length-1;
console.log(str[0].toUpperCase()+str.slice(1,last)+str[last].toUpperCase());
}
upperCase("cedrich");
+ 1
Can you please give one example and also post your try too
0
you must get the first and last char, turn them uppercase, then return concatenation of first (upper) char + 2nd to last-1 chars + last (upper) char...
you must also try by yourself first, then request for help if needed... do kot forget to provide link to your code attempt ^^
0
There is my code ande its returning NaN.....https://code.sololearn.com/WHcdb0nTpgm6/?ref=app
0
Thanks I Am AJ ! for the help ,i noticed what i was doing wrong.i appreciate the correction
0
Thanks visph for the help,thats another way of solving it that i had not thought about.
- 1
I have edited the parameters but its still returning NaN