Question: I have a string with values like this `a,b,c,d` and want to remove a specific letter by index

So here is what I did `str.split(',').splice(1,1).toString()` and this is (obviously) not working since `splice` is returning the values removed not the original array

Is there any way to do the above in a one liner?

```js
var str = "a,b,c,d";
console.log(str.split(',').splice(1,1).toString());
```

Thanks in advance.

Answer: 
You can use `filter` and add `condition` as `index != 1`.

```js
var str = "a,b,c,d";
console.log(str.split(',').filter((x, i) => i != 1).toString());
```
Splice works in place, so oneliner is 

```js
const arr = "a,b,c,d".split(','); arr.splice(1,1); console.log(arr.toString());
```

If you want an string in a oneliner, you have to hardcode the index in a filter

```js
console.log("a,b,c,d".split(',').filter((item, i) => i != 1).toString())
```

Or two slices (not performant at all)

```js
const arr = "a,b,c,d".split(',')
console.log([...arr.slice(0,1),...arr.slice(2)].toString())
```