Bug Tracker

Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#14216 closed bug (notabug)

Bug in code of document "Type"

Reported by: victorwoo@… 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 ]

Change History (5)

comment:1 Changed 10 years ago by Rick Waldron

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 )

comment:2 in reply to:  1 Changed 10 years ago by victorwoo@…

Replying to 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.

comment:3 Changed 10 years ago by victorwoo@…

comment:4 Changed 10 years ago by Rick Waldron

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

comment:5 in reply to:  4 Changed 10 years ago by victorwoo@…

Replying to 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 :)

Note: See TracTickets for help on using tickets.