JSFiddle - React, Tailwind, and code Playground

JavaScript

let requirements = [ "£", "$" ];
let mcontent = "$£50";
let y = 0;
for (let p = 0; p < requirements.length; ++p) {
    if (mcontent.includes(requirements[p])) {
        ++y;
    }
}
// check
console.log({y});
// resume
if (y == 1) {
    //this is considered success, only ONE currency symbol was detected. If mcontent = '$50' or '£50', we should be here.
} else {
    //this is considered failure, TWO or ZERO currency symbols were detected. In this scenario, I want the code to fail.
}