Function multiply

How to create a function that takes 10 and multiply s it with 2. Then result of that multiply by 2 and so on ?

What do you mean by “and so on”?

Well multiply result of 10 * 2 with 2 then result of that with 2 then result of that with 2 .

Do you want to do this with any number rather than just 10? Do you always multiply by 2 four times?

well pick some number and multiply with 2 then sum of that with 2 again then sum of that with 2 again and so on 10 times.

You want


like that?


like that?

first one aaaaaaaaaaaaaaaaaaaaaaaaa

Well, if you’re going to do the same thing over and over again, I’d use a loop.

function multiplyLots(num) {
  let result = num;

  // Loop over how many times yo want to multiply
  for (...) {
    result *= 2;
  return result;

this is it?
What can I put in parenthes?
I overthink this waaaaay too much

how do I loop it 10 times

Well, I’d use a for loop, like this:

I need to somehow break out of this loop right?
What I use to doo that result < 100?

For a for loop, your exit condition is usually how many times to iterate.

for (let i = 0; i < 42; i++) {

will iterate 42 times.

thanks man 1111111111111111