Skip to main content
Participant
Mar 14, 2021 8:15 PM UTC
Question

while Loops

Hello, I am very new to JavaScript. 

 

I am wondering if anyone can help me wrap my head around while Loops?? 

As an exercise I was reading about, it says: 

 

A penny the 1st day, double the second day, until you reach $1,000,000. How many days will you work of course I know the math for this. But it states I have to do this as a while Loop and then print it to the document.

 

How should I go about this? 

 

is there a template I can use that would help me for this and similar problems? 

 

Thanks and I hope to hear from someone soon!

This topic is closed to new replies. Start a new post to keep the conversation going.

24 replies

B i r n o u
Legend
Mar 15, 2021 4:18 AM UTC

Without wanting to create clans within this discussion, I agree with Ben and Nancy's point of view.
It is by forging that one becomes a blacksmith... or it is by learning to sin that one will avoid assisting by giving fish. and so on...
So to the list of valuable advice provided by Nancy, I would add one that seems to me to be the key to many algorithmic approaches and this source of inspiration, although it must be adapted to each reflection, is quite interesting
https://github.com/TheAlgorithms/Javascript

 

Translate
Nancy OShea
Community Expert
Community Expert
Mar 14, 2021 11:05 PM UTC

I'm afraid this isn't a Dreamweaver question as much as it's a coding question.  I'm with Ben, I don't do homework.  You'll learn more from exercising YOUR brain cells, not mine 🙂

 

Start here:

 

Translate
Nancy O'Shea— Product User & Community Expert
Legend
Mar 14, 2021 11:10 PM UTC

I'm with Ben, I don't do homework. You'll learn more from exercising YOUR brain cells, not mine

 

Funny - Ben uses a mostly automated program/extensions and you both use frameworks, not exactly using your own skills and abilities is it?

Translate
Nancy OShea
Community Expert
Community Expert
Mar 15, 2021 12:03 AM UTC

I have an automatic washing machine, too. So what?   You want me to drag laundry to the river bed and pound it with rocks because that's better than a machine?  Uh, I don't think so.

 

Work smarter, not harder 😉

 

 

Translate
Nancy O'Shea— Product User & Community Expert
Hawk_1Author
Participant
Mar 14, 2021 8:20 PM UTC

I also want to keep track of how many days I have worked, the current salary as it goes up, and the total amount of money earned. 

Translate
BenPleysier
Community Expert
Community Expert
Mar 14, 2021 9:36 PM UTC

This sounds like a homework assignment. Being  grumpy old man, I say to you 'Do your homework'. There are plenty of pointers on the web, just Bingle them.

Translate
Wappler is the DMXzone-made Dreamweaver replacement and includes the best of their powerful extensions, as well as much more!