This is where the error occurs. prevValue = "Yes" ? "No" : "Yes"
You are basically assigning prevValue
the value 'Yes'. This statement always returns true. To make it work, modify your conditional statement toprevValue === "Yes" ? "No" : "Yes".
Happy Coding!