If I define and create instance of class dynamically like below:
var type = 'Animal';
window[type] = function() {};
var animal1 = new window[type]();
var animal2 = new Animal();
Then animal1 will be shown in Chrome debugger as instance of Object (but with correct properties) while animal2 will have type window.Animal.
When Animal is defined statically:
function Animal() {}
both objects are seen as instances of Animal.
How can I achieve this while defining functions dynamically (without using eval) ?