Hows Set Object is implemented

That’s it, finally the good way of thinking.
For now just want to instant peek at values in same way as logging Set does.
Seems like ovveride .toString() can only achieve it in simple way, other solutions are to complex for begginner friendly community.

The ‘good way of thinking’? Rolling your own engine or forking an engine for a minor cosmetic change is an absurd idea. I brought it up to show where control over this behavior lives.

If you want a special debugging view of your object, focus on the goal instead of the specific implementation. Make a method that does what you want instead of trying to control unspecified behavior.

1 Like

Not to mention that you’d have to convince the majority of developers on the internet to use it so they can see your improvements :slight_smile:

2 Likes

@JeremyLT 8 posts and still not even proposition of solution for given problem, instead of type use the time to check out possibilities if you want to help someone.

@bbsmooth thanks for your effort.

You finally answered this question with

And I replied with

Which is what @bbsmooth said all along.

If you want to get a particular ‘peak’ inside of the object, write a new method that does what you want instead of trying to control console.log()s behavior that is specifically implementation dependent.

This will be the last time I reply because there is nothing more to say. The solution as you want it for your problem is “absurd”. That is what we have been trying to tell you all along and we have both given you workarounds. And please be a little more courteous to people who are trying to help you.

1 Like

why do you need to use Set in javascript while you have the most powerful item which is Object.
Declaration: { key : value, key : value, …}

array with object
[ Object, Object, …]

Object with array as value inside an Array
[ { myarray : [‘item1’, ‘item2’,…], … }, Object, … ]

Object inside an Object
{ obj1: { key : value}, obj2:{ key, value }, … }

Because then you don’t need to write an implementation of sets when you need a set. None of those things you listed behave like a set. They won’t unless you package them up with logic to make them have set-like behaviour. That is what the Set object does.

1 Like

Yeah its true that I create a sets like functions or method to behave it like sets. I am more familiar with it rather than sets, and i don’t use it often.

Anyway thank you for clarifying this for me. And i searched the net that Object is just raw, you need to code more and it may take more errors than using an already created data collection type such as Map, sets on the other hand is way different from Object which is a special type of collection.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.