I have a question, what if I have 50 strings in an array and I want to make the ones longer than 5letters have a red color, how do I do it? Please show help using the .map(function (element, index)if... method thanks
You cannot set color of a string. You can use this objects: {string:<string>,isRed:false}, and the can use for loop:
for(let stringObj of strings) {stringObj.isRed=stringObj.string.lenght>5} //strings: that array which contains the 50 string object