Javascript get Object property Name

If you know for sure that there’s always going to be exactly one key in the object, then you can use Object.keys:

theTypeIs = Object.keys(myVar)[0];

Leave a Comment