From 60d818eeec42f386061e3122cd68b35b2442db5a Mon Sep 17 00:00:00 2001 From: lichao Date: Thu, 9 May 2019 16:47:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=89=B9=E6=AE=8A=E5=80=BC?= =?UTF-8?q?=E8=8A=82=E7=82=B9=E7=9A=84=E6=B5=8B=E8=AF=95=E7=94=A8=E4=BE=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- javascript/06_linkedlist/SinglyLinkedList.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/javascript/06_linkedlist/SinglyLinkedList.js b/javascript/06_linkedlist/SinglyLinkedList.js index bc69148..f43ee68 100644 --- a/javascript/06_linkedlist/SinglyLinkedList.js +++ b/javascript/06_linkedlist/SinglyLinkedList.js @@ -105,3 +105,9 @@ console.log('-------------find by item------------') LList.findByValue('chen') console.log('-------------find by index------------') LList.findByIndex(2) +console.log('-------------与头结点同值元素测试------------') +LList.insert('head', 'sang') +LList.display() // chen -> qian -> sang -> head -> zhao -> zhou +LList.findPrev('head') // sang +LList.remove('head') +LList.display() // chen -> qian -> sang -> zhao -> zhou