Skip to content

Instantly share code, notes, and snippets.

@zhangolve
Created May 1, 2016 09:21
Show Gist options
  • Save zhangolve/9cf8c8ef9664fd3300b3ace17cb8019e to your computer and use it in GitHub Desktop.
Save zhangolve/9cf8c8ef9664fd3300b3ace17cb8019e to your computer and use it in GitHub Desktop.
var count = 0;
function cc(card) {
// Only change code below this line
function compare(count){
if(count>0)
{
return count+" Bet";
}
if(count===0)
{
return count+" Hold";
}
if(count<0)
{
return count+" Hold";
}
}
if(card>1&&card<7){
count+=1;
return compare(count);
}
if(card>6&&card<10){
return compare(count);
}
if(card==10||card=='J'||card=='Q'||card=='K'||card=='A'){
count-=1;
return compare(count);
}
}
// Only change code above this line
// Add/remove calls to test your function.
// Note: Only the last will display
cc(10);
cc('J'); cc('Q');cc('K'); cc('A');
//cc(2); cc(3); cc(4); cc(5); cc(6);
@zhangolve
Copy link
Author

嵌套函数功能块。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment