Dollar Dollar Bill explainer

The aim of this puzzle: Complete the inDollars function definition so that it converts cents into dollars.

Walkthrough of the solution: In between the 2 console.log(...) calls, the inDollars() function is called. When the puzzle starts, the function takes in an argument and stores it in cents. Then it assigns that value to wallet. Instead of doing that, we want to calcluate how many dollars those cents are worth and then store that inside wallet.

There are 100 cents in each dollar, so that means we divide cents by 100 to get the amount of dollars. Change wallet = cents into wallet = cents / 100, by using the / key, then the num key to insert 100.

Sample code solution:
(Tap below to reveal)

let wallet = 3600;

function inDollars(cents) {
  wallet = cents / 100;

console.log('You have ' + wallet + ' cents.');
console.log('You have ' + wallet + ' dollars.');

JavaScript Concepts: Arithmetic Operators (/), Binary Expression (+ concatenation), Calling Functions, Function Declarations, Code Block (function), console.log() , Variable Scope (let)

Instructions state to divide wallet by 100.
I feel instructions should have stated divide cents by 100
Not sure


Maria, I agree, and the coding and explanation given makes no sense to me. Anyone out there who understands this stuff and is willing to answer some related questions?

Hey there, I’m here to answer any questions you have.


1 Like

I think there is problem with scope of variables(wallet ) in this puzzle. If not then explain?

Why function did not make return call?


Hi @Grasshopper_Ben
Would convert the cent in dollars

Also I want to add that the app is not allowing to attach a screenshot or attach a picture

1 Like

5th and 7th line codes are same but output is different why (?) @Grasshopper_Ben plz​:pray:t2::pray:t2::pray:t2::pray:t2::pray:t2::pray:t2: I have been stucked.

Send a screen shot, please

Hi, guys.
Thanks for the app, I think it’s amazing to learn to code.

However, I think this code is a bit confusing.

It seems to me that it would be better in the following way:


Which text editor is this you are using

Hi, @Codeinventor

I’m using VS Code, the most popular code editor,
and the extension to take a screenshot inside VS Code is CodeSnap :camera_flash:.

I hope it is useful to you.

Yeah… Thanks a lot😊

1 Like

Why is the “return” code missing here?

1 Like

No comprendo este experimento

Ayuda acá por favor, es un experimento que estoy haciendo y no comprendo porqué me sigue dando “3600”
Se supone que la let"wallet" tiene como valor 3600, entonces en la función ese mismo argumento que se coloca en la función(en este caso es wallet) valga la redundancia, se debería transformar en bank dividido en 100(2000/100) y según yo debería resultar 20 porque se ha modificado, pero no es así, por favor quisiera una explicación de cómo funciona todo esto, para saber porque sigue resultando 3600 de wallet, gracias


Why does this function not require a return?

1 Like

I’ve been thinking about this too. I think it’s beacuse the purpose of the function is just to update the variable “wallet” for the new console.log line

Does wallet turn into cents then back into wallet?
How does the cents gets a number value from wallet?
Doesn’t let variable only work “inside the block {} where it’s created?”
@grasshopperexplainer @Grasshopper_Ben