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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:50:42+00:00 2026-05-23T02:50:42+00:00

I am playing with JS.Class v.3.0 http://jsclass.jcoglan.com/ and I would like to find a

  • 0

I am playing with JS.Class v.3.0 http://jsclass.jcoglan.com/ and I would like to find a way to detect the instance of an object.

            var Car = new JS.Class({
                hColors : new JS.Hash([]),

                initialize : function() {
                    this.hColors.store( "1", "red " ),
                    this.hColors.store( "2", "green " ),
                    this.hColors.store( "3", "blue " )
                },

                getColors : function( colorId, returnHash ) {
                    if ( this.hColors.get( colorId ) )
                    {
                        var currentObjects = this.hColors.get( colorId );

                        if ( returnHash )
                        {
                            return new JS.Hash([
                                colorId, currentObjects 
                            ]);
                        }

                        return currentObjects;
                    }

                    return this.hColors;
                }
            });

            var F150 = new Car();

            var F150Colors = F150.getColors(); //Hash:{1=>red ,2=>green ,3=>blue }
            //var F150Colors = F150.getColors( "2", false ); //String:green
            //var F150Colors = F150.getColors( "2", true ); //Hash:{2=>green }

            //How do I test if F1250 is an instance of JS.Hash?

As you can see, the getColors method can accept two arguments which will either return the whole Hash, a selected hash containing 1 value or simply the selected value.

The question is: How could I check if F150Colors is an instance of JS.Hash ?

The solution: typeof F150Colors == "string" is not enough because eventually, my hColors will contains objects ( {} ). And everything will be a typeof F150Colors == "object"

Thank you!

  • 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-23T02:50:43+00:00Added an answer on May 23, 2026 at 2:50 am
    if (F150Colors instanceof JS.Hash)
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Please see the class I have created at http://textsnip.com/see/WAVinAS3 for parsing a WAVE file
I am playing with this example http://scala.sygneca.com/code/remoteactors to learn how remote actors work in
I've been playing with Valum's AJAX upload script: http://valums.com/ajax-upload/ It ticks all the boxes
I have been playing with the list activity tutorial here: http://developer.android.com/resources/tutorials/views/hello-listview.html which tells you
I was playing around with this code. http://programmersvoice.com/tag/code And I noticed that the following
Was playing around a little bit with the TimeSpan class and I started wondering
I'm playing with Hibernate a little bit. I created a Group class and a
Recently I have been playing around with the HTTP Proxy in twisted. After much
I am playing around with Object Oriented Design/Database design by creating an application that
I am currently playing around with the HybridSessionBuilder class found on Jeffrey Palermo's blog

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.