is7
1
Hi all,
I’m getting the following code error
“TypeError: Attempted to assign to readonly property.”
this is the line it’s referring to:
if ((cvc !== “”)&&($w(‘#mmYYInput’).value !== “”)&&($w(‘#cardNameInput’).value !== “”)&&(goodcvc.test(cvc))&&(13 > parseInt(mm,16) > 0)&&(parseInt(yy,16) >= 19)&&(valid_credit_card($w(‘#cardNumberInput’).value)=== true )&&(goodcreditzip.test(zip))&&(zip.length=5)) {
console.log('order successful!')
}
Any ideas why this might be?
Have a look in your code.
When you use defineProperties, by default writable is set to false, so actually are read only properties. Explicitly set them to writable: true
is7
3
so if I were to say change
valid_credit_card($w(’ #cardNumberInput ').value)=== true
to:
let valid = valid_credit_card($w(’ #cardNumberInput ').value)=== true;
and then keep the code the same with the substitution it should work like this:
if ((cvc !== “”)&&($w(’ #mmYYInput ‘).value !== “”)&&($w(’ #cardNameInput ').value !== “”)&&(goodcvc.test(cvc))&&(13 > parseInt(mm,16) > 0)&&(parseInt(yy,16) >= 19)&&(valid)&&(goodcreditzip.test(zip))&&(zip.length=5)) { console.log(‘order successful!’)
}