🎙 Free live masterclass · Sun, 29 Nov, 7:00 pm IST · Java Full Stack roadmap Register free →
Skills101
← Quiz: Classes, Modules, Map and Set: all 10 questions

Quiz: Classes, Modules, Map and Set · Question 8 of 10

Which line is CommonJS rather than an ES module?

Which line is CommonJS rather than an ES module?

  1. A.import fs from "fs";
  2. B.export const x = 1;
  3. C.const fs = require("fs");
  4. D.import { join } from "path";
Answer & explanation

Correct answer: const fs = require("fs");

require and module.exports belong to CommonJS; import and export belong to ES modules.

Can you get the rest right without peeking?

Take the timed Quiz: Classes, Modules, Map and Set quiz free. Pass it to earn XP and count towards your certificate.

Start the quiz →