Functional programming: Difference between revisions

Content deleted Content added
GreenC bot (talk | contribs)
Reformat 8 archive links. Wayback Medic 2.5 per WP:URLREQ#iaboterr
Line 167:
The following two examples (written in [[JavaScript (programming language)|JavaScript]]) achieve the same effect: they multiply all even numbers in an array by 10 and add them all, storing the final sum in the variable "result".
 
Traditional Imperativeimperative Looploop:
<syntaxhighlight lang="javascript">
const numList = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10];
Line 178:
</syntaxhighlight>
 
Functional Programmingprogramming with higher-order functions:
<syntaxhighlight lang="javascript">
const result = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]