Skip to content

Commit 47ac582

Browse files
fix: Remove innerHTML sink in Palindrome Checker (#627)
1 parent ad1e829 commit 47ac582

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

apps/palindrome-checker/public/script.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@ const checkForPalindrome = input => {
1414
resultDiv.replaceChildren();
1515

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

2121
const pTag = document.createElement('p');
2222
pTag.className = 'user-input';
23-
pTag.innerHTML = resultMsg;
23+
pTag.innerText = resultMsg;
2424
resultDiv.appendChild(pTag);
2525

2626
// Show the result.

0 commit comments

Comments
 (0)