直接复制到html里就能运行,自己看一下吧
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<script src="
https://code.jquery.com/jquery-3.3.1.min.js"></script>
</head>
<style type="text/css">
</style>
<body>
<input type="button" name="" onclick="init()"/>
</body>
<script type="text/javascript">
function init(){//init是函数,执行某些操作集合
var a = 1;//a和b都是值
var b = 2;
var c = doPlus(a, b);
alert(c)
}
function doPlus(a, b){//传给另一个函数 a和b就是参数
c = a + b;
return c;
}
</script>
</html>