53 lines
923 B
HTML
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> |