0
javascript toLowerCase()
question: why is here the right answer âDaveoxfordâ and NOT âdaveoxfordâ? var name = âDaveâ; var school = âOxfordâ; name.toLowerCase(); school.toLowerCase(); console.log(name + school); //the ââ in the code are both up. just dont know why this is here not working. đ
7 Respostas
+ 6
You have to save the value in a variable. For example
var name = "Dave";
var school = "Oxford";
name =name.toLowerCase();
school=school.toLowerCase();
console.log(name +school);
+ 4
You have to save the value in a variable. In your code you were printing the same variable but not the lowercase value
+ 1
Strings are immutable in JavaScript so the toLowerCase() will not alter the actual string until and unless the change is assigned to the string itself. Try writing-
name=name.toLowerCase();
school=school.toLowerCase();
+ 1
Mylisa_beth read the first statement of my answer which tells the reason behind that behaviour.
+ 1
thank you folks!!! đđđđȘđȘđȘ
0
You could also try console.log(name.toLowerCase());