Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6827587
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T22:16:59+00:00 2026-05-26T22:16:59+00:00

I have three pages utilizing the same code and on one of the pages

  • 0

I have three pages utilizing the same code and on one of the pages this variable doesn’t exist, on the other two the variable ticketType has a value of 1 or 2. I need to first check if ticketType exists and isn’t undefined and secondly, need to determine if it’s one or 2.

This if statement generates an error:

if(typeof ticketType != undefined && ticketType == 1){}

It’s saying ticketType isn't defined. I tried nesting the if statements to check if it was defined first thinking it wouldn’t go and try the inner if statement but firebug still generates an error.

Any ideas? There has to be a way to do this…

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T22:16:59+00:00Added an answer on May 26, 2026 at 10:16 pm

    'undefined' needs to have quotes around it when used with typeof

    if(typeof ticketType != 'undefined' && ticketType == 1){}
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have three pages that has forms on them. They all lead to one
I have two tables (subjects and pages) in one-to-many relations. I want to add
I have one application where i have three jsp pages, from index.jsp , control
I have three pages 1) index.aspx 2) schools.aspx 3) Classes.aspx All the pages has
I'm playing with a GWT/GAE project which will have three different pages, although it
I have three tables: page, attachment, page-attachment I have data like this: page ID
So I currently have three unordered lists in my header. This is a single-page
I have three pages: Login.aspx, Index.aspx and a C# class file named GlobalData.cs The
I have three pages calculator1.aspx, calculator2.aspx and Menu.aspx. On each calculator page i have
I have three pages on my site. Page 1 is home page. When user

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.