Java Script linked list

I just read that blog about linked list and tried to do that then I got an output but that output is not match with the blog author. I need some help

class ListNode {
  constructor(data) { = data; = null;

class LinkList {
  constructor(head = null) {
    this.head = head;

// putting all together
let node1 = new ListNode(2);
let node2 = new ListNode(5);
// console.log(node1); = node2;

// let's create a linklist with node1
let list = new LinkList(node1);

console.log(; //output-: 2 but expected 5

What’s the difference? A contrast result? Depends on preference, it can be done the other way too: = node1;
let list = new LinkList(node2)

What I meant by preference is, for adding a node, User can add to the head, or add to the tail. Each has its pros and cons, will depends a lot on the situation and what kind of data being stored in the linklist.