Igor Snitkin
Nov 16, 2021

I'll buy you a knowledge coffee ☕

1. Reverse string

Try: `reverseString('knowledge coffee ☕')`

Didn't work, right?

Maybe like so:

```

const reverseString = (str) => Array.from(str).reverse().join('');

```

2. Get query params

This is incredibly BAD, starting from the fact that your function shadows native `URL` API which in turn might have been handy in this case:

```

const getSearchParams = (url) => new URL(url).searchParams;

```

3. Check even

As been correctly pointed out, when condition resolves to boolean it is fine to return the condition. Also could be done cheaper computationally:

```

const isOdd = (n) => !!(n & 1);

```

Igor Snitkin
Igor Snitkin

Responses (1)