console
var g1=1;
function text1(){
var j1=2;
document.write(g1+"</br>");
}
var j3=3;
function text2(){
var j4=4;
document.write(j3+"</br>");
}
text1();
text2();
function Sum(a,b){
return a+b;
}
var sum=100+Sum(2,3);
document.write(sum+"</br>");
function callAlert(){
document.write("hallo");
}
function Pd(year){
if(year>0){
if(year%400==0||(year%4==0&&year%100!=0)){
document.write("闰年"+"</br>");
}
else{
document.write("不是闰年"+"</br>");
}
}
else{
document.write("没有这个年份"+"</br>");
}
}
Pd(2022);
Pd(2000);
Pd(-2);
function Max(a,b,c,d){
var arr=new Array(a,b,c,d);
var max=arr[0];
for(var i=1;i<arr.length;i++){
if(max<arr[i]){
max=arr[i];
}
}
return max;
}
var a=Max(12,321,332,0);
document.write("最大值为"+a+"</br>");
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title></title>
<link rel="stylesheet" type="text/css" href="index.css"/>
<script src="js/index.js"></script>
</head>
<body>
<button onclick="callAlert()">调用</button>
</html>
</body>