Get Programming with JavaScript - Listing 7.07
Listing 7.07 - Converting a string to upper case
JS Bin
var planet = "Jupiter";
var bigPlanet = planet.toUpperCase();
console.log(planet + " becomes " + bigPlanet);
Further Adventures
Listing 7.07 - Converting a string to upper case - Task 1
- Create a getBig function that accepts a string as an argument and returns it converted to upper case.
var planet = "Jupiter";
var getBig = function (text) {
return text.toUpperCase();
};
console.log(planet + " becomes " + getBig(planet));
Listing 7.07 - Converting a string to upper case - Task 2
- Create a getSmall function that accepts a string as an argument and returns it converted to lower case.
var planet = "Jupiter";
var getSmall = function (text) {
return text.toLowerCase();
};
console.log(planet + " becomes " + getSmall(planet));