<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>Document</title> <script> var name = '小李飞刀'; //alert(name); /* var age = 16; if (age > 18) { alert('您已成年;'); } else { alert('您还未成年;'); } */ var age = 18; var res = age < 26; //alert(typeof(res)); //对象 var obj = new Object(); //alert(typeof(obj)); //数组 var arr = [1, 2, 3, 4, 5]; //alert(typeof(arr)); //自定义函数,匿名函数 function func(num1, num2) { var sum = num1 + num2(); return sum; } var result = func(2018, function() { return 2019; }); alert(result); </script> </head> <body> </body> </html>