var answer = Number(Math.floor(Math.random()*10));
do{
var number = Number(prompt("Guess a number"));
if(number-answer >10){
alert("Too big!!");
}
else if(number-answer < 10 && number>answer ){
alert("It's bigger, but you are close!");
}
else if(answer-number < 10 && number<answer){
alert("It's smaller, but you are close!");
}
else if(answer-number > 10){
alert("Too small!!");
}
else if(number==answer){
alert("You WIN !!");
break;
}
}while(number!=answer);