# Functions practice in JavaScript

In the tasks below, you will need to write functions. Give them the correct names that reflect their essence, and also, if necessary, use auxiliary functions, including those obtained in previous tasks.

Make a function that takes an array as a parameter and returns the sum of its elements.

Make a function that takes a number as a parameter and returns an array of its divisors.

Make a function that takes a string as a parameter and returns an array of its characters.

Make a function that takes a string as a parameter and flips its characters in reverse order.

Make a function that takes a string as a parameter and capitalizes the first letter of that string.

Make a function that takes a string as a parameter and capitalizes the first letter of each word in that string.

Make a function that fills an array with integers from `1` up to the given one.

Make a function that will return a random element from an array.

Make a function that will take a number as a parameter and check if it is prime or not.

Make a function that will check a pair of numbers for friendliness. Amicable numbers are two numbers for which the sum of all proper divisors of the first number is equal to the second number and vice versa, the sum of all proper divisors of the second number is equal to the first number.

Using the function you created from the previous task, find all pairs of amicable numbers between `1` and `1000`.

Make a function that will check the number for perfection. A perfect number is a number whose sum of its own divisors is equal to that number.

Find all lucky tickets. A lucky ticket is a ticket where the sum of the first three digits of its number is equal to the sum of the second three digits of its number.

Make a function that takes two numbers as a parameter and returns an array of their common divisors.

Make a function that will take a number and return that number in words. Let the function work with numbers up to `999`. See an example:

`func(123); // prints 'one hundred twenty three'`
← →
↑
en ru