What is the equivalent of this JS code in DWScript please? I use the DWScript codegen.
// JavaScript:
DoIt({name:"Fred", size:{width:3,height:2}});
I tried anonymous record but it seems not working:
var obj: variant;
obj := record
Name = 'Fred';
Size: variant = record
Width = 3;
Height = 2;
end;
end;
The generated JS code with DWScript Codegen is:
var obj = undefined,
/// anonymous TRecordSymbol
function Copy$a$460(s,d) {
return d;
}
function Clone$a$460($) {
return {
}
}
function Pub$a$460($) {
return {
"Name":$.Name$8
,"Size":$.Size$5
}
}
/// anonymous TRecordSymbol
function Copy$a$461(s,d) {
return d;
}
function Clone$a$461($) {
return {
}
}
function Pub$a$461($) {
return {
"Width":$.Width$4
,"Height":$.Height$2
}
}
obj = {Name$8:"Fred",Size$5:3};
alert(JSON.stringify(obj));