well this is the problem: """For this task you'll need to gain access to a target's account, which is password protected. We know the password is only four characters long, but we have no idea of what it looks like.
With today's computing power, brute-forcing weak passwords is not that hard and, as in any brute-force technique, it only requires time and luck.
Instructions
You know that your target's password is 4 characters long, so you'll just have to brute force 1 character at a time. We already declared the variable correctGuesses which you should use to keep track of how many characters you have guessed so far.
Bear in mind that your program does not need to guess the password, that is not your goal!
You need to create a loop that only stops when all 4 characters have been guessed. On each loop iteration you need to calculate a random number between 1 and 3, which will correspond to each of the bellow scenarios:
You guessed one character correctly, which increases correctGuesses by 1 and prints the message 'Found X characters' (where X is replaced with the current number of correct guesses).
You guessed incorrectly and your target's terminal has detected too many attempts, which resets correctGuesses to 0 and prints the message 'Starting over' to the console.
You guessed incorrectly, but have not been detected yet, correctGuesses is kept with the same value.
Once the password is cracked (that is, correctGuesses has a value of 4) you should print the message 'Terminal hacked!'.
Make sure all the messages in your code are in the correct format in order to advance!""""
And this is my code :
var correctGuesses = 0;
var randomNumber = Math.ceil(Math.random()*3);
console.log(randomNumber);
while (correctGuesses < 4){
console.log(correctGuesses);
if (correctGuesses === 4){
console.log('Terminal hacked!');
break;
}
if (randomNumber === 1){
correctGuesses = correctGuesses +1;
console.log('Found' + ' '+ correctGuesses+'characters');
break;
}
if (randomNumber === 2){
correctGuesses = 0;
console.log(correctGuesses);
break;
}
if (randomNumber === 3){
console.log(correctGuesses);
break;
}
}
so i am having a hard time to make my correctGuesses var to add 1 each time randomNumber var gives us 1. already tried out to the change the order of the comands lines, i am making instead of Math.random method put 1 and simply dont add that plus 1, what i am doing wrong if someone could help me i would be very glad