Need come code help

Hi everyone, new here :slight_smile:
so i have an issue, im supposed to try and find the password from the following code. i understand i need to use the ascii table but im a little bit confused, i would appreciate any help!

<script>
    var pass = [];

    $("#search").click(function () {

        for(item of password.value)
        {
            if (item.charCodeAt(0) % 2 == 0){
                pass.push(item.charCodeAt(0)+3)
            }else{
                pass.push(item.charCodeAt(0)-1)
            }
        }

        if (String.fromCharCode(...pass) == "leet"){
            alert("you rock");
        }
        else
        {
            alert("try again... ");
        }
    });

</script>

```

paste your code between ``` ``` instead of using screenshots

so people can just copy and paste into their editor to help you better

what do you think the problem is
what errors are you getting
have you tried using console.log() to see what output you get during each step?

1 Like

thanks for the advise
i have a basic form with an input box, i need to find the password, i have minimum knowledge with js
i understand the password has 4 letters, im not sure how to handle more than that. do i need to do some reverse calculation in order to get the results? i see the sign % which is 37 in decimal, not sure how to continue from here.

can anyone help with that?

Your question is missing so much information. Where are you reading this question from?

the answer is mbbu, I would suggest you see how, need a little math knowledge to make a function that solves it

1 Like