why module exports not working in javascript?

I want to use module.exports to move User to another folder, but it is not working

The console give this error

script.js:542 Uncaught ReferenceError: module is not defined

class User {
  constructor(name, email) {
    this.name = name;
    this.email = email;
  }
  courseList = [];
  getInfo() {
    return {
      name: this.name,
      email: this.email
    };
  }

  enrollCourse(name) {
    this.courseList.push(name);
  }
  getCourseList() {
    return this.courseList;
  }
}

module.exports.User;

This in the new folder

import User from "./script";

const piyush = new User("piyush", "[email protected]");

console.log(piyush);