Advertisement
teofarov13

Untitled

Nov 7th, 2021
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. function cardio(input){
  2.     let steps=0
  3.     index=0
  4.     let comand=input[index];
  5.     index++
  6.    
  7.     while(steps<=10000){
  8.     if(comand ==="Going home"){
  9.         steps+=Number (input[index]);
  10.         index++
  11.         break;
  12.      }
  13.      let temp=Number(comand)
  14.      steps+=temp
  15.      
  16.      comand=input[index]
  17.      index++
  18.    }
  19. if(steps >=10000){
  20.     let diff=steps - 10000
  21.     console.log( `Goal reached! Good job!`)
  22.     console.log(`${diff} steps over the goal!`)
  23. }else{
  24.     console.log(`${10000-steps} more steps to reach goal.`)
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement