- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
var React = require("react");
function Factorial({n, result}){
result = result || 1;
if(!n){
return <span>{result}</span>
}else{
return <Factorial n={n - 1} result={result*n}/>
}
}
module.exports = Factorial;
huge_cock 18.01.2017 13:28 # +2
Siri0n 18.01.2017 13:39 # 0
1024-- 18.01.2017 23:23 # 0
huesto 18.01.2017 23:28 # +2
barop 18.01.2017 23:32 # 0
метапрограммироване
huesto 18.01.2017 23:39 # 0
cykablyad 19.01.2017 06:23 # 0
Siri0n 19.01.2017 08:11 # +1
var React = require("react");
function Factorial(_ref) {
var n = _ref.n,
result = _ref.result;
result = result || 1;
if (!n) {
return React.createElement(
"span",
null,
result
);
} else {
return React.createElement(Factorial, { n: n - 1, result: result * n });
}
}
module.exports = Factorial;