I have a TestComplete (UI testing) project which uses JavaScript, and I'm trying to store class references in JSON. It seems that my code isn't working, so I might have a conceptual misunderstanding of how JavaScript handles class references in JSON. Here's code which demonstrates my line of thinking:
class MyClass {
constructor() {
this.name = "ClassName";
}
}
function print_name(str_name) {
console.log(str_name);
}
let my_json = {
"keyOne": [
MyClass
]
};
let class_ref = my_json["keyOne"][0];
print_name(class_ref.name);
Is there a reason why the print_name function would fail to print the "name" property of the MyClass object?