Bird
Raised Fist0

What will be the result of this JavaScript code snippet used in security testing?

medium📝 Predict Output Q5 of Q15
Testing Fundamentals - Non-Functional Testing
What will be the result of this JavaScript code snippet used in security testing?
const input = "";
const safeInput = input.replace(/" as output.
  • Final Answer:

    "alert('XSS')" -> Option A
  • Quick Check:

    Replace removes only opening tag, closing remains [OK]
  • Quick Trick: Replace removes only matched text, others stay [OK]
    Common Mistakes:
    MISTAKES
    • Expecting both removed
    • Confusing replace with replaceAll
    • Assuming output is unchanged

    Want More Practice?

    15+ quiz questions · All difficulty levels · Free

    Free Signup - Practice All Questions
    More Testing Fundamentals Quizzes