How to compare the Password field with retype password field

I am creating signup page. Therefore I want to compare Password input field with the Retype password input field.

Here you go

let password1 = $w("#passwordFieldId1").value;
let password2 = $w("#passwordFieldId2").value;

if (password1 === password2) {
 console.log("They match!");
} else {
 console.log("The don't match");
}

Thank You So Much…!! @ Andreas Kviby

You can mark as top commnet if you want so people see that is solved your issue.

that code is not working please send updated one