We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
2 parents 87e9c04 + 37e3576 commit b222af4Copy full SHA for b222af4
chapter05/01-Linked-List.js
@@ -138,7 +138,7 @@ function LinkedList() {
138
string = '';
139
140
while (current) {
141
- string = current.element;
+ string += current.element + (current.next ? '\n' : '');
142
current = current.next;
143
}
144
return string;
@@ -148,4 +148,4 @@ function LinkedList() {
148
this.print = function(){
149
console.log(this.toString());
150
};
151
-}
+}
0 commit comments