Forum Discussion

tyrus's avatar
tyrus
Contributor
9 years ago

Jscript Enum

Hi,

is is possible in Test Complete to use enums?

 

I try this https://msdn.microsoft.com/en-us/library/y94acxy2%28v=vs.90%29.aspx

and test complete errors out....

 

Thanks in advance

  • Hi tyrus,

     

    The link you posted is about JScript .NET, not JScript.

    JScript does not have enums as such, but you can emulate them using objects with named properties:

    var Days = {
      Monday: 1,
      Tuesday: 2,
      Wednesday: 3,
      ...
    }
    
    if (day == Days.Monday) ...

     

  • HKosova's avatar
    HKosova
    SmartBear Alumni (Retired)

    Hi tyrus,

     

    The link you posted is about JScript .NET, not JScript.

    JScript does not have enums as such, but you can emulate them using objects with named properties:

    var Days = {
      Monday: 1,
      Tuesday: 2,
      Wednesday: 3,
      ...
    }
    
    if (day == Days.Monday) ...