I tried to join and add line break to my nested array using join and \n as you can see:
const exampleArray = [["Hello"], ["world"], ["example"]]
.map((el) => el)
.join("\n");
everything works. I get this output which is what I want:
Hello
world
example
but when I tried to add this exampleArray to a value inside of an object, it shows the \n itself instead of line break.
this is what I did:
const theObj = {
value: exampleArray,
};
and this is what I get in the output:
Object { value: "Hello\nworld\nexample" }
I want to have my text with line breaks in value. what is the problem and how can I solve it?
theObj.valueandexampleArrayare identical.