Kevin Powell - CommunityKP-C
Kevin Powell - Community3y ago
8 replies
JOY

Not able to do import export functions in node.js project

I'm making a memory game, I want to export a function.

logic.js
 function incrementAttempts(){
        attempts++;
        attemptsHolder.textContent = attempts;
        }
//Other functions-----

module.exports = {incrementAttempts}


app.js
const incrementAttempts  = require('./public/logic');


the app is keep crashing, i tried changing type to module in package.json, there was still no change
Was this page helpful?