Code
Hub
Workspaces
Connect
Indexed graphs
Engine
MCP
copy
hub
/
github.com/tensorflow/tfjs-examples
/ sum
Function
sum
cart-pole/utils.js:35–41 ·
view source on GitHub ↗
(xs)
Source
from the content-addressed store, hash-verified
33
* @throws Error
if
`xs` is empty.
34
*/
35
export
function
sum(xs) {
36
if
(xs.length === 0) {
37
throw
new
Error(
'Expected xs to be a non-empty Array.'
);
38
}
else
{
39
return
xs.reduce((x, prev) => prev + x);
40
}
41
}
Callers
2
setUpUI
Function · 0.90
mean
Function · 0.85
Calls
no outgoing calls
Tested by
no test coverage detected