Transcript from the "Linked List: Head, Tail & Contains" Lesson

[00:00:00]

>> Bianca Gandolfo: So, what else can we do? So we removed. So is head, this was easy, right? Return this.head.

>> Bianca Gandolfo: Wait, this is isTail. Return, so we have a node. So return node, if node === this.head.

>> Student: You're just checking whether it's true or not?

>> Bianca Gandolfo: Yeah, like is the node, the head, is this the tail.

[00:00:39] So it's gonna return a boolean. Yeah. Contains, so contains is another one where you would loop through. So what we could do is. So we're gonna pass some value against. So this one we're checking for a particular value, not a node. But we would have to loop through pretty similarly So I'm gonna copy our remove tail implementation.

[00:01:04] And so we're gonna start at the beginning. We have our value. So while current node value is not equal to our value, keep looping.

>> Bianca Gandolfo: So, and then once we exit. So, if currentNode.value === value, actually we could just return this. So if it equals, if does equal return true, if not this will return false.