I'm about to style the "newResult" with green if passed and red if failed. I'm confused how to style them since the "newResult" is not DOM.
@param {string} idIn
function checkId(idIn) {
let isIDin = false;
let regexID = /^n|N[0-9]{8}$/i;
if (regexID.test(idIn)) {
isIDin = true;
}
return isIDin;
}
function test__checkId(valueIn, expected){
let result = checkId(valueIn);
var newResult;
//Print out value we are testing, and result of the function, and our expectation.
if (result){
newResult="==PASSED==";
} else {
newResult="XXFAILEDXX";
}
let msg = "Value tested: " + valueIn + " | Expected result: " + expected + " " + newResult + "<br />";
document.getElementById("data").innerHTML+=msg;
}
//TIME TO RUN OUR UNIT TEST FUNCTION ON OUR checkHumberID FUNCTION...
test__checkId("n99999999",true); //boundary testing
test__checkId("n00000000",true); //boundary testing
test__checkId("ASFASDF",true); //boundary testing

