Text slider in JavaScript

In this section, we will create sliders. Let's start with the simplest ones and gradually get more complex.

Let's start with the text slider. This slider will be a div in which the text will change every second:

<div id="slider"></div>

We will store the texts for the slider in an array:

let texts = ['text1', 'text2', 'text3'];

The solution algorithm will be as follows: you need to start a timer that will insert a new array element into our div every second - the first, then the second, then the third, and then the first again, and so on in a circle.

Implement described slider.