Skip to content

Javascript – convert value of object to uppercase

I have an object in my or IONIC

{name:"food panda", city:"selangor", phone:"0123456789"}

and use the following code but it’s not working:;

I need to convert food panda to FOOD PANDA.

How can I do that?


toUpperCase returns a new String, it doesn’t modify the original

var restaurant = { name: "food panda", city: "selangor", phone: "0123456789" };;

console.log(;           // output: food panda

var restaurantName =;

console.log(restaurantName);            // output: FOOD PANDA