4 ms·
>The often unmentioned killer feature part of js is that you can express tree data directly This is the case in almost all well-used programming languages. Cal
by Nicksil 5y ago
>The often unmentioned killer feature part of js is that you can express tree data directly
This is the case in almost all well-used programming languages. Calling it a "killer feature" is a bit of a stretch; it's more an expectation.
- singularity2001 5y agoYou are right. I was thinking of Java, C, C++, and C# but my knowledge about the last ones was outdated (long ago) https://stackoverflow.com/questions/138600/initializing-a-static-stdmapint-int-in-c https://stackoverflow.com/questions/138600/initializing-a-st... https://stackoverflow.com/questions/15501202/c-sharp-nested-dictionaries https://stackoverflow.com/questions/15501202/c-sharp-nested-... IF you are happy with some constraints or the syntax exploding with every level of tree depth added: public Dictionary<string, Dictionary<string, string>> info = new Dictionary<string, Dictionary<string, string>> ....
- jakopo87 5y agoYou can define type aliases at the begin of the file to reduce verbosity, as example: using dic = System.Collections.Generic.Dictionary<string, string>; Otherwise you can use an anonymous type: var person = new { name = "frank", address = new { city = "Berlin ", zip = 12345 } }; In this case you get a plain object, but all fields area read only.
- singularity2001 5y agoInteresting and beautiful