How can I get a list of words that contain at least one uppercase letter in a string, without repeating?
In my attempt, it only gives me the result of the last word of the string, that is: You.
function Calculate()
{
var str = "JavaScript is used in billions of Web pages to add functionality, validate forms, communicate with the server, and much more. JavaScript is easy to learn. You will enjoy it.";
var res = "";
var newAr = str.split(/[ .,]+/).filter(String);
for(var i = 0; i < newAr.length; i++) {
if(newAr[i].match(/[A-Z]/)) {
var WordCapLetts = newAr[i];
}
}
res += "<br>Palabras con al menos una letra mayuscula: " + WordCapLetts;
document.getElementById("result").innerHTML = res;
}