dynamic vs object type

They’re hugely different. If you use dynamic you’re opting into dynamic typing, and thus opting out of compile-time checking for the most part. And yes, it’s less performant than using static typing where you can use static typing. However, you can’t do much with the object type anyway – it has hardly any members. Where … Read more

Best way to flatten JS object (keys and values) to a single depth array

I wanted to flatten my deep object to one level depth. None of the above solutions worked for me. My input: { “user”: { “key_value_map”: { “CreatedDate”: “123424”, “Department”: { “Name”: “XYZ” } } } } Expected output: { “user.key_value_map.CreatedDate”: “123424”, “user.key_value_map.Department.Name”: “XYZ” } Code that worked for me: function flattenObject(ob) { var toReturn = … Read more