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

  • SEARCH
  • Home
  • 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 8516577
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T05:28:04+00:00 2026-06-11T05:28:04+00:00

I have the folowing code: var windowNow = window.localStorage.getItem(windowNow); switch(windowNow) { case 1: var

  • 0

I have the folowing code:

var windowNow = window.localStorage.getItem("windowNow");
switch(windowNow)
{
case 1:
    var link = "http://www.zive.sk/rss/sc-47/default.aspx";
    var listviewID = "feedZive";
    break;
case 2:
    var link = "http://mobilmania.azet.sk/rss/sc-47/default.aspx";
    var listviewID = "feedMobil";
    break;
case 3: 
    var link = "http://www.automoto.sk/rss";
    var listviewID = "feedAuto";
    break;
}

and I know that windowNow === 1 because I have checked it with alert and also to be sure that it realy is 1 I checked it with if(windowNow == 1) { alert ("Window now is 1");} and it worked. But it is not working inside my switch (checked it with alerts).

  • 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-06-11T05:28:06+00:00Added an answer on June 11, 2026 at 5:28 am

    The items in the localStorage are always strings. Use case "1" and so on.

    The problem with your check is that is a loose check, which doesn’t check for the data type. You should have tried

    if(windowNow === 1) { alert ("Window now is 1");}
    

    Notice the triple =.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: var submitHandler = function ($link, $form, close) { var
I have the following JS: http://monobin.com/__m1c171c4e and the following code: Code: var tpl =
I have the following code: var formSubmitHandler = function (link, form) { //e.preventDefault(); var
I have the folowing code: var transitionsSettingsClass = document.getElementsByClassName(transitionsSettings); var myLenght = transitionsSettingsClass.lenght; alert(myLenght);
I have the folowing code: function checkPermission(user) { var result = 'default'; $.get('/mymodule/checkPermission.php?user=' +
I have the folowing code: var transitionsSettingsClass = document.getElementsByClassName(transitionsSettings); var transitionsSettingsClassLenght = transitionsSettingsClass.length; for
I have the following code: var btns1 = { 'Submit': function (win) { submitHandler(oLink.$link,
I have the following code: var refreshId = setInterval(function() { $(#footad).html('myjshere'); }, 15500); Where
I have the following code: var carsContext = new CarsDataContext(); IQueryable<Car> allCars = carsContext.Cars;
I have the following code var dbvalue = Ned; var deleteLink = '<a href=#delete

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.