markdown guide
 

This is how I'd do it in Python:

def delete_dupl(list):
    deleted = {}
    # add each element to a map
    for item in list:
        deleted[item] = 1
    # clear list to replace with the shortened one
    list.clear()
    for key in deleted:
        list.append(key)
    return deleted
print(delete_dupl(<given_list>))

There's probably a better way but adding each item to a map (dict) is enough, as there can't be repeated keys; then pass every key to an array.

 

Ok..
I don't speak python for now. Am a newbie in JavaScript trying to work on that task.

Thanks for your response...👍

 

Well, I'm not fluent on JS either but I don't think they're so different at tackling this problem :)

Classic DEV Post from Aug 22

Where in the world do you DEV?

Show off where in the world you DEV from!

mr.Felistus profile image
I am Obieze Ezeugo,a frontend design enthusiast(newbie). Currently learning frontend Web design. Design,football,music