I've always relied on functions but I am not trying to understand the differences between classes and functions. Are there a difference between these two in instantiating a Node? When logging them in console, they seem to log the same but I am trying to see if there's anything I am not seeing that is different.
function Node(data, left, right) {
this.data = data;
this.left = left;
this.right = right;
}
let foo = new Node(55);
----------
class Node {
constructor(data,left,right) {
this.node = data;
this.left = left;
this.right = right;
}
}
let foo = new Node(55);