Please help with some simple Javascript

Can’t seem to find to google the right thing… does anyone with more experience in JS than me know how you take a raw text input that looks like this:

And convert that text to something that my script can use (mainly looking for the /n elements so I can identify line breaks) that looks more like this:

\n\nApple AirPods Pro \nAnker PowerCore Portable Charger \nHydro Flask Insulated Stainless Steel Water Bottle with Straw Lid  \nFujifilm Instax Mini 9 Camera Bundle \nPatagonia Women's Nano Puff Jacket

Check out this jsfiddle

I suspect the info you are missing is that backticks (`) are needed for multiline JS variables.

That sorted it. Thanks so much @lindsay_knowcode

1 Like

just to complement, the name is “Template literals (template strings)”. more