Created
February 9, 2018 14:42
-
-
Save petyosi/bcf5a185877ae6363f4b648764c0d12b to your computer and use it in GitHub Desktop.
This file contains 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
import multiply from './multiply'; | |
import sum from './sum'; | |
const totalMultiply = multiply(5, 3); | |
const totalSum = sum(5, 3); | |
console.log(`Product of 5 and 3 = ${totalMultiply}`); | |
console.log(`Sum of 5 and 3 = ${totalSum}`); |
This file contains 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
import sum from './sum'; | |
const multiply = (a, b) => { | |
let total = 0; | |
for(let i=0;i<b;i++) { | |
total = sum(a, total); | |
} | |
return total; | |
}; | |
export default multiply; |
This file contains 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
const sum = (a, b) => a + b; | |
export default sum; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment