# Must-Know JavaScript One-Liners for Developers: Part 1

* ### Reverse a string
    
    The `split` function helps us break a string into multiple individual elements, which can then be `reversed` and `joined` to a full string.
    

```javascript
function isPalindrome(str) {
   return str === str.split('').reverse().join('');
     
}

// Example usage:
console.log(isPalindrome("racecar")); // Output: true   // Output: false
```

* ### R**emoving Duplicates from an Array**
    

> Removing duplicates involves creating a new array that only contains unique elements.

```javascript
function removeDuplicates(arr) {
    return [...new Set(arr)];
}

// Example usage:
console.log(removeDuplicates([9, 2, 2, 3, 4, 4, 5])); 
// Output: [9, 2, 3, 4, 5]
```

* ### flattenArray
    

> flatten array can be directly done using the flat property of the array.

```javascript
function flattenArray(arr) {
    return arr.flat(Infinity);
}
// Example usage:
console.log(flattenArray([1, [2, [3, [4, 5]]]]));
```

That's it for today's brief read. More will be coming in the next parts, so stay tuned. Follow for more updates.
