I'm trying to get an object's base type but failing. Chrome's console seems to be able to do it, but I can't.
Here's what the console is giving me:
I'm trying to get Blockly.FieldDropdown
somehow.
How is Chrome console able to find it out, but I can't ?
The object is returned by Google Blockly:
var block = Blockly.mainWorkspace.getBlockById(e.blockId);
var field = block.getField(inputId); //field is the object shown in console above...
Or as a standalone working example:
var field = new Blockly.FieldDropdown([['left', 'LEFT'], ['right', 'RIGHT']]);
// these return an empty string, but I'd like to get back "Blockly.FieldDropdown"
console.log(Object.getPrototypeOf(field).constructor.name);
console.log(field.__proto__.constructor.name);
// the following shows "Blockly.FieldDropdown" in front of the properties
// in Chrome's dev console (but not in Firefox for example,
// and the name is not accessible):
// console.log(field);
<script src="https://cdn.jsdelivr.net/npm/blockly@3.20191014.3/blockly.min.js"></script>
I've tried finding a Blockly method that returns the type, but I haven't seen one.