Created
June 30, 2020 01:52
-
-
Save mason276752/d111f7d03b119bb694ff72b381443364 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// let mobiles=["xxxx":{"to":"oooo","count":0,"finded":false},...] | |
let ms=Object.keys(mobiles) | |
ms.forEach(function active(mobile){ | |
if(!mobiles[mobile].finded && mobiles[mobile].count<3 && mobiles[mobile].to!==""){ | |
mobiles[mobile].count=mobiles[mobile].count+1 | |
if(!mobiles[mobiles[mobile].to]){ | |
mobiles[mobile].finded=true | |
return console.log('can not found ',mobiles[mobile].to) | |
}else{ | |
active(mobiles[mobile].to) | |
} | |
} | |
mobiles[mobile].finded=true | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment