How to check a variable is undefined

Questions and answers about Plum Fuse+

Moderators: admin, support

  • Author
  • Message
Offline

henry

  • Posts: 16
  • Joined: Tue Aug 01, 2017 2:11 pm

How to check a variable is undefined

PostWed Sep 13, 2017 4:40 pm

How to check a variable is undefined in compare variables module?
We tried the undefined, 'undefined' and '', all the choices do not works.
Any suggestions?
Offline

support

  • Posts: 3348
  • Joined: Mon Jun 02, 2003 4:47 pm
  • Location: Boston, MA

Re: How to check a variable is undefined

PostWed Sep 13, 2017 5:48 pm

The compare variables module interprets data as strings. If you wish to check for a undefined variable in Javascript, you will have to use the Evaluate JS module with code like:

Code: Select all
if ([variable] === undefined) { [variable] = 'undefined'; }


Then you can check the variable with the compare variables module, since you have changed its value to the string "undefined".

However, it is not good coding convention to intentionally send undefined variables, so we would recommend rethinking your application to not rely on undefined variables.

Return to Fuse+

Who is online

Users browsing this forum: No registered users and 1 guest

cron