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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T07:33:22+00:00 2026-05-24T07:33:22+00:00

I found a difference in the handling of [1,2,3].slice(1, undefined) between chrome (that returns

  • 0

I found a difference in the handling of

[1,2,3].slice(1, undefined)

between chrome (that returns [2,3]) and firefox (that returns []).

Both of course instead agree on [2, 3] as the value of

[1,2,3].slice(1)

and they also both agree on [] as the value of

[1,2,3].slice(1, null)

Which of the two is correct? Or may be this not clearly specified in the standard?

  • 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-24T07:33:22+00:00Added an answer on May 24, 2026 at 7:33 am

    The specification says:

    7. If end is undefined, let relativeEnd be len; else let relativeEnd be ToInteger(end).

    Which Firefox version are you using? Firefox 5 gives me correctly [2, 3]. Update: Firefox 3.6 returns indeed an empty array.

    I don’t know what is wrong here, because if you call slice() without a second parameter, end will be undefined too.


    Update:

    After playing around a bit, it seems that an empty array is returned if the second parameter passed to .slice() is NaN. Example (+undefined returns NaN):

    > [1,2,3].slice(1, +undefined)
    > []
    

    This is the same in Firefox and in Chrome.

    Unfortunately, this is also not conform to the specification, as ToInteger(NaN) [spec] should return 0, so the the array should actually be sliced to the end.

    I don’t claim that this is the reason why it does not work properly in some Firefox versions, I don’t know the implementation.

    Incident of minor disorientation… never mind.

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

Sidebar

Related Questions

Declaration;) MKMapView mapView; I can't found the difference between mapView.userLocation.location.coordinate and mapView.userLocation.coordinate. Is there
I finally found out the difference between UTC and GMT by making the effort
Reading Kohana's documentation, I found out that the main difference in 3.0 version is
I have an application that I've been working on and found a troubling difference
I found What are mvp and mvc and what is the difference but it
While googling I found two different sets of headers that need to be set
I found out that I can use a different theme in an C# WPF
I've found a feature on two different websites that I'd like to include on
I just found Has anyone published a detailed comparison between different in-memory RDBMSs ?
I am studying Intel Protected Mode. I found that Call Gate, Interrupt Gate, Trap

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.