Task: Remove every other line web form app

The goal of this is to create a web-form that has a text input field where the user can paste text and then, below the form, it will print out the resulting lines.

The functionality is to remove every other line, either removing odd, or even rows.

There should be a radio button that has two options:

Remove odd Remove even

(so remove odd starts with removing the first row, even starts with the second)

  • There are some functions here that can be used for this, as a start, otherwise you can write it separately. The goal is to use functional programming for this to keep pure functions that can be re-used, if needed. Please keep the form decoupled from the other functions:


1.- Does that means that I would receive an input and I have to split those lines starting with the first one or depending on the input?

Yes, this depends on whether the user selects to start with "odd" or "even".

2.- Which are the necessary criteria to split the lines according to the entry?

There should be an npm library for this, we want to use some normal standard, basically, the user will be pasting in lines into text area of the form. I think there is library that can parse this out into lines.

3.- What is the entry that is going to receive? Can you give me an example?

For example, the input could be:

Sentence for line 1
Sentence for line 2
Sentence for line 3
Sentence for line 4
Sentence for line 5

If the user selects start remove starting with "odd", the output would be:

Sentence for line 2
Sentence for line 4

4.- And what criteria to split the entry?

We are just taking in the whole line, so we are not splitting within the actual line itself

Posted on Nov 30, 2017