Want to get rid of Google Ads, click here.
+ Reply to Thread
Results 1 to 2 of 2

Thread: Check for existence of variable in JavaScript

  1. #1
    Junior Member
    Join Date
    Mar 2006
    Posts
    8

    Default Check for existence of variable in JavaScript

    Trying to access a variable that does not exist in SC6.1 results in an error.

    For example, doing the following:

    print( system.vars.$test );

    Results in:

    Script 'junk' line 806: ERROR Unknown RAD symbol '$test' at char 1


    Is there a way to check for the existence of the variable from within JavaScript before trying to use it?

  2. #2
    Senior Member
    Join Date
    Apr 2006
    Location
    Poland
    Posts
    680

    Default

    I have not tested it but try:

    print( system.functions.nullsub(system.vars.$test, "empty") );

    beware: I have no SM at hand, so I might have mistaken something.

    regards
    Artur

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

     

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts