I have array of Objects which is look like this
object=
[
 {
  id:`01`,
  name:`fish`,
  type:`marine`,
 }
 {
  id:`02`,
  name:`fish`,
  type:`fresh`,
 }
 {
  id:`03`,
  name:`fish`,
  type:`tank`,
 }
 {
  id:`04`,
  name:`animal`,
  type:`pet`,
 }
 {
  id:`05`,
  name:`animal`,
  type:`wild`,
 }
 {
  id:`06`,
  name:`animal`,
  type:`zoo`,
 }
 {
  id:`07`,
  name:`food`,
  type:`veg`,
 }
 {
  id:`08`,
  name:`food`,
  type:`non-veg`,
 }
]
I want to store them uniquely but in string format so when i call them i can fetch them easily
- I tried to get value by using map function
let object=
    [
     {
      id:`01`,
      name:`fish`,
      type:`marine`,
     },
     {
      id:`02`,
      name:`fish`,
      type:`fresh`,
     },
     {
      id:`03`,
      name:`fish`,
      type:`tank`,
     },
     {
      id:`04`,
      name:`animal`,
      type:`pet`,
     },
     {
      id:`05`,
      name:`animal`,
      type:`wild`,
     },
     {
      id:`06`,
      name:`animal`,
      type:`zoo`,
     },
     {
      id:`07`,
      name:`food`,
      type:`veg`,
     },
     {
      id:`08`,
      name:`food`,
      type:`non-veg`,
     }
    ]
    
    object.map((value)=>{
console.log(value.name)
})so i am getting the output as
fish
fish
fish
animal
animal
animal
food
food
- but i need them distinctly
fish
animal
food
even i tried to store them in one variable to get the output in
let object=
[
 {
  id:`01`,
  name:`fish`,
  type:`marine`,
 },
 {
  id:`02`,
  name:`fish`,
  type:`fresh`,
 },
 {
  id:`03`,
  name:`fish`,
  type:`tank`,
 },
 {
  id:`04`,
  name:`animal`,
  type:`pet`,
 },
 {
  id:`05`,
  name:`animal`,
  type:`wild`,
 },
 {
  id:`06`,
  name:`animal`,
  type:`zoo`,
 },
 {
  id:`07`,
  name:`food`,
  type:`veg`,
 },
 {
  id:`08`,
  name:`food`,
  type:`non-veg`,
 }
]
let gotValue= [...new Set( object.map((value)=>{
return value.name;
}))];
console.log(gotValue);so i am getting this value as
[
"fish"
"animal"
"food"
]
but i need value in string format
expected value=
fish
animal
food
 
    