Created
February 9, 2018 14:38
-
-
Save petyosi/4323fd79bf0b71789257e3e8e2c8df32 to your computer and use it in GitHub Desktop.
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
<html> | |
<head> | |
<script src="src/sum.js"></script> | |
<script src="src/multiply.js"></script> | |
<script src="src/index.js"></script> | |
</head> | |
</html> |
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
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); |
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
var multiply = function (a, b) { | |
var total = 0; | |
for (var i = 0; i < b; i++) { | |
total = sum(a, total); | |
} | |
return total; | |
}; |
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
var sum = function (a, b) { | |
return a + b; | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment