Assigning values to object

I have this code which doesn’t work for me. New project, only code is this…

 act = {}
 act.ageRange = {min: 12, max: 18}

I can assign text but not values or boolean. Any tips?

I think there must be a bug

I can assign a value then a string .ageRange = {min: 12, max: "18"}
but not a string then a value .ageRange = {min: "12", max: 18}

image

Seems the Basic to JS conversion is not putting the colon after the object name

I just tried this here and it worked properly.

Can you make a minor change to the code and rerun? This will force the translator to redo the conversion.

I encountered a similar issue (Array assignments not being parsed correctly) some time ago. I believe the cause was a reserved word being used somewhere in my code and being parsed triggering the error. I’ve also sometimes encountered odd errors with mixed Javascript and Basic in a module where javascript code can have syntax incorrectly validated ie js function incorrectly gets altered to Function

Worked OK for me today. Tried to replicate it, couldn’t for a while, then I remembered the With statement had issues.
To replicate…
Type in this code to new project. Runs ok.

act = {}
act.ageRange = {min: 12, max: 18}
console.log("act.ageRange.min:" & act.ageRange.min & " act.ageRange.max:" & act.ageRange.max)

Add a With statement. Compiles with no colons. Errors obviously.

act = {}
With act
  .ageRange = {min: 12, max: 18}
End With
console.log("act.ageRange.min:" & act.ageRange.min & " act.ageRange.max:" & act.ageRange.max)

image

Even after removing the With statement it still stops the Basic converter putting colons in. Errors again obviously.
image

Also discovered in this process that if I run an app in the Desktop browser, then load another project and run that in the Desktop browser it will run the previous project. Closing the window in the browser of the previous project then allows the current project to run in Desktop browser.

The With statement in BASIC is a difficult one to translate properly into JavaScript. We do the best we can, but if it’s acting up, it might be better to use a different technique.