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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T07:23:38+00:00 2026-06-05T07:23:38+00:00

Boot up your interpreter/console and try the comparison: > ",,," == Array(4) True Why?

  • 0

Boot up your interpreter/console and try the comparison:

> ",,," == Array(4)
True

Why? At first I thought maybe since you could think of ",,," as an array of four characters with a ‘\0’ terminating slice, that might be why, but

> "..." == Array(4)

Returns "False". So… why? I know it’s some idiosyncratic bit of duck typing in JavaScript, but I am just curious what underlines this behavior. I gleaned this from Zed Shaw’s excellent presentation here, btw.

  • 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-05T07:23:40+00:00Added an answer on June 5, 2026 at 7:23 am

    Because the right hand operand is converted to a string and the string representation of Array(4) is ,,,:

    > Array(4).toString()
      ",,,"
    

    If you use the array constructor function and pass a number, it sets the length of the array to that number. So you can say you have four empty indexes (same as [,,,]) and the default string representation of arrays is a comma-separated list of its elements:

    > ['a','b','c'].toString()
      "a,b,c"
    

    How the comparison works is described in section 11.9.3 of the specification. There you will see (x == y):

    8. If Type(x) is either String or Number and Type(y) is Object,
    return the result of the comparison x == ToPrimitive(y).

    (arrays are objects in JavaScript)

    and if you follow the ToPrimitive method you will eventually find that it it calls toString.

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

Sidebar

Related Questions

I am studying the boot process in Linux. I came across this sentence "RAM
After the boot loader hands execution over to the kernel, what happens? I know
I have a boot complete broadcast receiver but it wasnt working as expected. Nor
I would like to dual boot ubuntu 12.04 and OSX Lion. Is there a
I'm trying to build a VxWorks boot loader that is PXE-bootable from Workbench, but
By default JBoss 5.1 writes boot traces to $JBOSS_HOME/server/default/log folder . Is it possible
I am trying to build my own boot loader that loads then switches from
How can I receive notification of system boot on the installed windows phone 7.5
I found this site: http://www.os-forum.com/minix/boot/ which claims to document the boot sequence of Minix.
I've had several errors in kernel logs on device boot after all partitions were

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.