Skip to content

Instantly share code, notes, and snippets.

Last active Apr 16, 2019
What would you like to do?
// lib/counter.js
var counter = 1;
function increment() {
function decrement() {
module.exports = {
counter: counter,
increment: increment,
decrement: decrement
// src/main.js
var counter = require('../../lib/counter');
console.log(counter.counter); // 1

This comment has been minimized.

Copy link

@Mr-tailor Mr-tailor commented Jul 27, 2018

counter.counter will have value of 2

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment