Skip to content

Instantly share code, notes, and snippets.

@petyosi
Last active February 9, 2018 14:40
Show Gist options
  • Save petyosi/9eebfe9dfb2ec991441b249a966a5303 to your computer and use it in GitHub Desktop.
Save petyosi/9eebfe9dfb2ec991441b249a966a5303 to your computer and use it in GitHub Desktop.
<html>
<head>
<script src="./dist/bundle.js""></script>
</head>
</html>
var multiply = require('./multiply');
var sum = require('./sum');
var totalMultiply = multiply(5, 3);
var totalSum = sum(5, 3);
console.log('Product of 5 and 3 = ' + totalMultiply);
console.log('Sum of 5 and 3 = ' + totalSum);
var sum = require('./sum');
var multiply = function (a, b) {
var total = 0;
for (var i = 0; i < b; i++) {
total = sum(a, total);
}
return total;
};
module.exports = multiply;
var sum = function (a, b) {
return a + b;
};
module.exports = sum;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment