I am trying to create an object in typescript that has a string key and a string value.
const titleValue: string = "key";
const objectINeed = {
titleValue: 'value'
};
console.log(JSON.stringify(objectINeed))
This prints
"{"titleValue":"value"}"
I instead want this to return {"key" : "value"}
I am not able to understand why the titleValue variable's stored value is not being picked up. Apologies if the title of the question is making it difficult to understand. I did not have better words for my problem as I am quite new to typescript and javascript.