CSP - U5L8 Bubble 9 - Code.org glitchy?

Student has this code

var secret = 1;
onEvent(“login_btn”, “click”, function() {
getText(“password_input”)=secret;
if (secret==123) {
showElement(“unlock_img”);
hideElement(“lock_img”);
console.log(“unlocked”);
}
if (secret!=123) {
showElement(“lock_img”);
console.log(“loggin failed”);
}
});

and is getting this error on line 3
ERROR: Line: 3: SyntaxError: Assigning to rvalue (3:0)

that there is your problem. you’re setting getText("password_input") to secret which is assigned 1. you can’t assign a getter a value, if you want to change the text do setText("password_input",text) if you want to set sectet to getText("password_input"), you should do:

secret = getText("password_input");
2 Likes