N
N
Nikita Andreevich2019-08-13 08:55:29
JavaScript
Nikita Andreevich, 2019-08-13 08:55:29

Recursion, why in return multiplication?

Good day.
Help me understand the algorithm of actions, a recursive function call:
5d52501c3c7d0460637129.png
Why do we multiply x by our function?
After all, logically, this call should go through x times until n !== 1.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
M
Makssof, 2019-08-13
@NikitosAndreevich

If there is no multiplication, then what will be returned from the head function?

pow(2, 3): // 8
return 2 * pow(2, 2): // 2 * (2 * 2)
___________return 2 * pow(2, 1): // 2 * 2
______________________return 2 // 2

Without multiplication:
pow(2, 3): // 2
return pow(2, 2): // 2
_______return pow(2, 1): // 2
______________return 2 // 2

A
Andrey Nikolaev, 2018-01-03
@GS3

I’ll add the Alexander option , it would be nice to make a background with the first second of the video, after loading, replace it with video playback.
In addition, it would not be superfluous to reduce the size of the video (asap) and use a CDN.

I
Igor, 2018-02-07
@picpromd

poprobite video bitrate converter

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question