Skip to main content

Bug Tracker

Side navigation

#14216 closed bug (notabug)

Opened August 05, 2013 02:02AM UTC

Closed August 05, 2013 03:14AM UTC

Last modified August 05, 2013 04:41AM UTC

Bug in code of document "Type"

Reported by: victorwoo@gmail.com Owned by:
Priority: undecided Milestone: None
Component: unfiled Version: 1.10.2
Keywords: Cc:
Blocked by: Blocking:
Description

http://api.jquery.com/Types/#Array

x.sort() [ 1, 2, 3 ]

x.splice( 1, 2 ) [ 2, 3 ]

should be

x.splice( 1, 2 ) // [ 1 ]

Attachments (0)
Change History (5)

Changed August 05, 2013 03:14AM UTC by rwaldron comment:1

resolution: → notabug
status: newclosed

It's only a "typo" if you're expecting the current value of x, but that output is the return value of x.splice( 1, 2 )

Changed August 05, 2013 03:23AM UTC by victorwoo@gmail.com comment:2

Replying to [comment:1 rwaldron]:

It's only a "typo" if you're expecting the current value of x, but that output is the return value of x.splice( 1, 2 )

Am I misunderstand?

The correct result is: [ 1, 2, 3 ].splice(1, 2) = [ 1 ]

But the document means: [ 1, 2, 3 ].splice(1, 2) = [ 2, 3 ] ,which is wrong.

Changed August 05, 2013 03:33AM UTC by victorwoo@gmail.com comment:3

Changed August 05, 2013 04:22AM UTC by rwaldron comment:4

Thanks for the fiddle, but you're missing the point of what I said. You're expecting to see the current state of "x", but the documentation is showing the _return_ _value_ of splice. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice

Changed August 05, 2013 04:41AM UTC by victorwoo@gmail.com comment:5

Replying to [comment:4 rwaldron]:

Thanks for the fiddle, but you're missing the point of what I said. You're expecting to see the current state of "x", but the documentation is showing the _return_ _value_ of splice. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/splice

Ok ok, I've understand at, finally :P

But I'd wish the document to point out it, to reduce different meanings :)