This commit is contained in:
14
05_react/uebungen/u02-03_mathfn-modul/assets/js/MathFn.js
Normal file
14
05_react/uebungen/u02-03_mathfn-modul/assets/js/MathFn.js
Normal file
@@ -0,0 +1,14 @@
|
||||
// Factory Function
|
||||
const MathFn = () => {
|
||||
// closures
|
||||
const add = (a, b) => a + b;
|
||||
const subtract = (a, b) => a - b;
|
||||
|
||||
const multiply = (a, b) => a * b;
|
||||
const divide = (a, b) => {
|
||||
return b === 0 ? NaN : a / b;
|
||||
};
|
||||
|
||||
export { add, subtract, multiply, divide };
|
||||
};
|
||||
export default MathFn;
|
||||
Reference in New Issue
Block a user