I have an array of strings, I want to display the content with some html tags in the alert level. I tried this:
array = ["toto", "titi"]
alert("*" + array.join('\n'))
but the problem here, I got only the first line with *. how can I resolvr this probleme to show all the lements with * in the begining ?
You should use map method to create a new array populated with each element having * prefix.
const array = ["foo", "bar"];
alert(array.map(value => `*${value}`).join('\n'));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With