Javascript solution using map - lemonadeChange
\nvar lemonadeChange = function(bills) {\n    let change={\'5\':0, \'10\':0};\n    for (let bill of bills) {\n        if (bill==5) change[5]++;\n        else if
```\nvar lemonadeChange = function(bills) {\n    let change={\'5\':0, \'10\':0};\n    for (let bill of bills) {\n        if (bill==5) change[5]++;\n        else if (bill==10) {\n            if (!change[5]) return false\n            change[10]++;\n            change[5]--;\n        } else { //bill==20\n            if (change[5] && change[10]) {  \n\t\t\t// first way for giving change: bill of 10 + bill of 5\n                change[10]--;\n                change[5]--;\n            }else if(change[5]>=3) {\n\t\t\t// second way for giving change: 3 bills of 5\n                change[5] -= 3 ;\n            }else return false\n        }\n    }\n    return true\n};\n```
['JavaScript']