Dedupe an array in javascript
Input : An array
Output : An array
Logic :
- Iterate over the input array called 
data - Add the element to the output array called 
resultif the element does not exist in the output array - Return the output array
 
Time complexity : O(n) ; where n is the string length
Space complexity : O(1) ; constant
Solution :