I am learning Linear Data Structures in JavaScript via Codecademy and in lesson's introduction it states:
We are going to use a provided Node class, which you can find in Node.js.
The code in their built-in IDE is as follows:
const Node = require('./Node');
class LinkedList {
}
module.exports = LinkedList;
When you look at the Node.js file referenced in require, there is a Node class defined like so:
class Node {
constructor(data) {
this.data = data;
this.next = null;
}
setNextNode(node) {
if (!(node instanceof Node)) {
throw new Error('Next node must be a member of the Node class');
}
this.next = node;
}
getNextNode() {
return this.next;
}
}
module.exports = Node;
So basically, does this already exist in a Node.js module to avoid having to access them all for this lesson, or did they create a custom class named Node?