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

1 Like

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.


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

Why function did not make return call?

1 Like

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