extract uppercase words nodejs

const str = "Hello WORLD from Node.js"; const uppercaseWords = str.match(/\b[A-Z]+\b/g); console.log(uppercaseWords); // Explanation: // 1. Assigns the input string to the variable 'str'. // 2. Uses the match() method with a regular expression /\b[A-Z]+\b/g to find uppercase words. // 3. The regular expression \b[A-Z]+\b matches one or more uppercase letters surrounded by word boundaries. // 4. The g flag is used to perform a global search, finding all matches rather than just the first one. // 5. Outputs the result array to the console.