1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071 |
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <meta charset="UTF-8">
- <title>入门</title>
- </head>
- <body>
- <script>
-
-
-
- function method1(a){
- console.log("method1")
- console.log("参数"+a);
- }
-
- method1(20);
- function method2(){
- return "hello js";
- }
-
- let b = method2();
- console.log("返回值:"+b)
-
- let m1 = function (){
- console.log("m1")
- }
-
- m1()
- m1()
-
- let s = "将指定的字符串传入函数内,在浏览器形成打印机的效果";
- function print(s){
- let s1 = "";
- let body = document.getElementsByName("body")[0];
-
- for (let i = 0; i < s.length; i++) {
- s1 += s.charAt(i)
- console.log(s1)
- }
- }
- print(s)
-
- function isYear(year){
- return (year % 4== 0 && year % 100 == 0) || year % 400 == 0 ;
- }
-
- console.log("是否是闰年:"+isYear(2000))
- </script>
- </body>
- </html>
|