How to encrype passcode with SHA256 in the source code?

Hi, I prepared a simple passcode function as below. But I would also like the passcode to be SHA256 encrypted in the source code, so that the passcode does not show in the source code.

Any idea how to implement that?
It looks like crypto.js can be used, not sure…

// Set the correct passcode
var correctPasscode = "123456";

// When all fields are entered, validate the passcode
$(".passcode-field").on("keyup", function () {
  if ($(".passcode-field").eq(5).val().length == 1) {
    var enteredPasscode = "";
    $(".passcode-field").each(function () {
      enteredPasscode += $(this).val();
    });
    if (enteredPasscode == correctPasscode) {
      // If the passcode is correct, redirect to the specified URL
      window.location.replace("https://example.com");
    } else {
      // If the passcode is incorrect, show an error message
      $("#error-message").text("Please try again.");
    }
  }
});