I have a local storage key in the form of a string. Here's how it looks :
var key = localStorage.getItem(localStorage.key(0));
console.log(key);
Above console prints :
{"logged_user":"myname","abcDatatitle":"AHarmbca Reports","abcData":"300"};
Just FYI : console.log(typeof key); prints string
I want to remove this part "abcDatatitle":"AHarmbca Reports"
so that the key (console.log(key);)
would look like the following :
{"logged_user":"myname","abcData":"300"};
I could use the replace
function of javascript like this,
key = key.replace("abcDatatitle","");
but this would remove only this abcDatatitle
part. How can I make sure that the whole part "abcDatatitle":"AHarmbca Reports"
is gone considering the
fact that this value AHarmbca Reports
is a dynamic value.