https://github.com/andriikot/node.js-lesson-5
Node.js Lesson 5
https://github.com/andriikot/node.js-lesson-5
Last synced: 5 months ago
JSON representation
Node.js Lesson 5
- Host: GitHub
- URL: https://github.com/andriikot/node.js-lesson-5
- Owner: AndriiKot
- Created: 2023-03-27T09:40:11.000Z (over 2 years ago)
- Default Branch: master
- Last Pushed: 2023-03-27T16:13:46.000Z (over 2 years ago)
- Last Synced: 2024-12-28T16:43:13.715Z (7 months ago)
- Language: JavaScript
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Node.js-lesson-5
Node.js Lesson 5___
```node
let counter = 0;module.exports.counterStep = function () {
counter++;
}
module.exports.displayCounter = function () {
console.log('Counter is', counter)
}```
```node
const myModule = require(node: './myModule1.js')myModule.displayCounter()
myModule.counterStep()
myModule.displayCounter()
console.log(myModule.counter) // Counter is 0
// Counter is 1// console.log(counter) // ReferensError
```