Conversation
| @@ -0,0 +1,117 @@ | |||
| // TASK 0 | |||
| const solution = arr => { | |||
| let newArr = []; | |||
There was a problem hiding this comment.
For at all, we could look at what we need from our array? We have to reduce its size but leave the same arguments.
So the first step will be to use .filter method.
A solution can look that way
- Take the element
- Take the element-index
- Take leaved part of an array to element-index
- Check if some elemnt in array is bigger than current element ( please note, there the same JavaScript method called .some
- if no one from that elements is bigger than current, leave it in array otherwise drop it
So I guess it could be solved with
.filter + .some from arrays method
| //TASK1 | ||
| class Carousel { | ||
| constructor() { | ||
| this.arrImg = ["bestsportcar170.jpg", "Acura-NSX-2016-2017-02.jpg", "ferrari_667_171011.jpg"]; |
There was a problem hiding this comment.
Probably Carousel should not be worrying about picture names.
Our Carousel should only be responsible to know about
- active element
- changing elements left/right
That's all. And we have to apply it in several places in every app :) without any knowledge of pictures
| } | ||
| }; | ||
| let carousel = new Carousel(); | ||
| carousel.buttonOperation(); |
There was a problem hiding this comment.
that call seems weird - because it looks like the internals of Carousel.
As a developer who uses your carousel, I don't want to worry about buttonOperation. I want just apply your carousel and it works "out of the box"
No description provided.