JavaScript Taskbook Level 4.7

Задание 1

Make a function that will take a text with words as a parameter and return a text in which these words will be sorted in alphabetical order.

Задание 2

Create a function that takes two arrays as parameters and returns an array of their common elements.

Задание 3

Make a function that will return a random number. The function should not return the same number twice in a row.

Задание 4

Make a function that takes an array and an element as a parameter and returns the next element. See the example:

javascriptlet arr = [1, 2, 3, 4, 5];

func(arr, 1); // 2
func(arr, 4); // 5
func(arr, 5); // 1