+ 1
How can I stop a function from further running after an if condition.Like if x>=5 ...function should stops and a message display
JavaScript
4 ответов
+ 1
You mean as follows
function mymessage(message, condition ) {
if (condition){
return;
}
console.log(message);
}
0
Hi Manpreet
I think you want a while loop
while (counter < 5) {
// do my game function stuff
counter++;
}
console.log("Game Over");
0
you mean while or do while
- 1
No I want to set a counter for no. of turns if user play 5 turns then ok if counter reaches 5 then function should stop and just give a message you loose or win like this.