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 8094855
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T20:55:49+00:00 2026-06-05T20:55:49+00:00

This Boolean comparison always returns false but it is comparing false == false in

  • 0

This Boolean comparison always returns false but it is comparing false == false in my getColumnsFunction(). It should return true, and I have no clue why. Here is the code:

function getModelColumns(exlude, modelName){    
    var model = Ext.ModelManager.getModel(modelName).create();
    var fields = model.fields.items;

    for(var x in fields){
        console.log( inArray(exlude, fields[x].name == false),
                    'boolean_compare', 
                     inArray(exlude, fields[x].name));
     }

}
function inArray(arr,val){
    for(var x in arr){
        if(arr[x] === val)
            return true;
    }

    return false;
 }

Here is what is in console.log() for all fields in that for loop:

false "boolean_compare" false 

They are both equal to false, why they heck does that boolean comparison return false?

Edit: forgot a ‘(‘ it should be inArray(exlude, fields[x].name ) == false

  • 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-05T20:55:50+00:00Added an answer on June 5, 2026 at 8:55 pm

    This expression:

    inArray(exlude, fields[x].name == false)
    

    will first compare the name to false, and as they are not equal it will call inArray(exclude, false). Unless it’s an array containing the value false it will always return false.

    I think that you want:

    inArray(exlude, fields[x].name) == false
    

    which will search for the name in the array, then compare the result to false.

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

Sidebar

Related Questions

Why does <xsl:if test=<XPATH to boolean value here>> ... </xsl:if> ALWAYS return true? Since
Does Java have an &= operator? I'm seeing this code: boolean allReady = true;
How to make this method return boolean value, depending on query return. False -
In my application I have: private bool _clear = true; This boolean is used
I need to do some logical comparison and return a boolean answer. Here is
i have written a method in java like this public boolean ADD(String ID,String Name,String
Having this method: public Boolean isCorrect() { return correct; } I can't write: @XmlType(propOrder
This isn't valid code: public class MyClass { private static boolean yesNo = false;
I'm pretty certain I'm missing something really obvious here but this seems quite bizarre.
I have a variable that can either be boolean false , or an integer

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.