# Basic JavaScript Day 3: Homework

**URL:** <https://group.classcentral.com/t/basic-javascript-day-3-homework/35089>\
**Category:** JavaScript Bootcamp\
**Created:** [September 7, 2022, 8:53am UTC](https://group.classcentral.com/t/basic-javascript-day-3-homework/35089 "2022-09-07T08:53:53Z")\
**Posts on this page:** 1\
**Showing post:** 48

<div class="post-metadata">

**Author:** ![syllie](https://sea2.discourse-cdn.com/flex016/user_avatar/group.classcentral.com/syllie/32/6257_2.png) [@syllie](https://group.classcentral.com/u/syllie)\
**Post date:** [September 13, 2022, 10:20pm UTC](https://group.classcentral.com/t/basic-javascript-day-3-homework/35089/48 "2022-09-13T22:20:05Z")

</div>

Hi Lina,

I now looked closer at your code, and sorry for not pointing this out earlier, but your case **returns** a string regardless of the actual **value** of count. As the **count** variable lives in the **global** space, it will keep its value on each call to the function. So to solve this challenge successfully, you need to do this in 2 steps:

1. Evaluate the card and add either +1, 0, -1 to the **count** variable
2. Evaluate the **count** variable, and if it is positive, return the current count and _Bet_, otherwise return the current count and _Hold_

Some other tips:

- note that you do not need to ‘add’ anything when the card is 7, 8 or 8 - so you could consider leaving these out of the ‘case’ evaluation, _if_:
- you evaluate and return the solution **outside** of the switch (aka: use the switch to change count, return your function **after** the switch)
- you can stop evaluating the card after you found its value as _case_ - so it would be better to `break;` (but the last case evaluation does not need it as you are done anyways).

I hope this helps Lina. If you are still stuck - let me know and I will post a code sample.

---

_[View the full topic](https://group.classcentral.com/t/basic-javascript-day-3-homework/35089)._
