← 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?
- A.import fs from "fs";
- B.export const x = 1;
- C.const fs = require("fs");
- 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 →