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];
More Related Contents:
- Javascript: Do I need to put this.var for every variable in an object?
- JSON: why are forward slashes escaped?
- Group objects by multiple properties in array then sum up their values
- Javascript seconds to minutes and seconds
- How do you send images to node js with Axios?
- My javascript is returning this error: $.ajax is not a function
- Detect Close windows event by jQuery
- jQuery change event on not firing in IE
- Javascript and Garbage collection
- Completely lost on how to save extension popup window content
- Input field for Tags separated by comma
- How to get nodes lying inside a range with javascript?
- How can I see the machine code generated by v8?
- jQuery load content when scroll to bottom-100px of page, multiple events fired
- How to create a multi-filter function to filter out multiple attributes?
- Split JavaScript array in chunks using Lodash
- Using jQuery, how do you find only visible elements and leave hidden elements alone?
- How to get the image size (height & width) using JavaScript
- WebRTC – scalable live stream broadcasting / multicasting
- What does “res.render” do, and what does the html file look like?
- Hook a javascript event to page load
- Jquery getJSON cross domain problems
- Only numbers. Input number in React
- iframe not reading cookies in Chrome
- Split a string, at every nth position, with JavaScript? [duplicate]
- Pass Node.js environment variable with Windows PowerShell [duplicate]
- Emulate clicking a link with Javascript that works with IE
- What is the new proper way to use a child selector with a context node in jQuery?
- Determine if a CSS class exists with Javascript
- How to convert a hexadecimal string to Uint8Array and back in JavaScript?