Files
unisa_tsw_2014_2015/js_20.html
2014-11-30 18:46:24 +01:00

53 lines
923 B
HTML

<!DOCTYPE html>
<html>
<head lang="en">
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script>
function costruisci (input){
if (input == "somma"){
f = function (a,b){
if (!isNaN(a) && !isNaN(b))
return a + b;
return null
}
return f;
} else if (input == "molt"){
f = function (a,b){
if (!isNaN(a) && !isNaN(b))
return a * b;
return null
}
return f;
}else
return null;
}
document.writeln((costruisci("somma"))(10,20));
document.writeln((costruisci("molt"))(10,20));
</script>
</body>
</html>