Skip to content

Commit

Permalink
fix: Remove innerHTML sink in Palindrome Checker (#627)
Browse files Browse the repository at this point in the history
  • Loading branch information
sylwia-budzynska authored Nov 20, 2024
1 parent ad1e829 commit 47ac582
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions apps/palindrome-checker/public/script.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ const checkForPalindrome = input => {
resultDiv.replaceChildren();

const lowerCaseStr = input.replace(/[^A-Za-z0-9]/gi, '').toLowerCase();
let resultMsg = `<strong>${originalInput}</strong> ${
let resultMsg = `${originalInput} ${
lowerCaseStr === [...lowerCaseStr].reverse().join('') ? 'is' : 'is not'
} a palindrome.`;

const pTag = document.createElement('p');
pTag.className = 'user-input';
pTag.innerHTML = resultMsg;
pTag.innerText = resultMsg;
resultDiv.appendChild(pTag);

// Show the result.
Expand Down

0 comments on commit 47ac582

Please sign in to comment.