Created
May 8, 2019 04:49
-
-
Save kakopappa/d120888a20b74a8971ce1f489ee964bc to your computer and use it in GitHub Desktop.
nodejs class import example
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// list.js | |
class LinkedList { | |
constructor() { | |
} // END constructor | |
myMethod() { | |
console.log("myMethod"); | |
} | |
} | |
// module.exports.myMethod = function() { | |
// console.log("myMethod"); | |
// } | |
module.exports = LinkedList; | |
// app.js | |
var LinkedList = require('./list.js'); | |
const someone = new LinkedList(); | |
someone.myMethod(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment