<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<title>Hello, world!</title>
</head>
<body>
<h1>Hello, world!</h1>
</body>
<script language="JavaScript">
let result;
const a = 1;
const b = 2;
function add(key, val) {
// console.log(key,val);//key=1;val=2
return key + val
}
const testFunction = function (fn) {
result = fn(a, b);
}
testFunction((key, val) => add(key, val))
console.log(result) //result=3
</script>
</html>