Blogger Information
Blog 42
fans 0
comment 0
visits 36361
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
10月21号作业 js基础
庆选的博客
Original
909 people have browsed it

1、把js变量、语句、表达式例子联系一下

  1. 1 js变量基本类型包括undefined/boolean/number/string/null
  2. 2JavaScript语句由以下构成 运算符、表达式、关键词和注释。
  3. 3、表达式:是由运算元和运算符(可选)构成,并产生运算结果的语法结构。
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Title</title>
  6. </head>
  7. <body>
  8. </body>
  9. </html>
  10. <script>
  11. var test;
  12. console.log(typeof test);
  13. var test1 = true;
  14. console.log(typeof test1);
  15. var test2 = 123;
  16. console.log(typeof(test2));
  17. var test3 = '123';
  18. console.log(typeof(test3));
  19. var test4 = null;
  20. console.log(typeof(test4));
  21. if(test4===null){
  22. console.log('这是一个语句判断')
  23. }
  24. </script>

2、函数定义及调用、匿名函数联系一遍

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="UTF-8">
  5. <title>Title</title>
  6. </head>
  7. <body>
  8. </body>
  9. </html>
  10. <script>
  11. function add(a,b) {
  12. return (a+b);
  13. }
  14. var x=function(a,b) { return a+b;};
  15. var func = add(2,5);
  16. console.log('这是常规函数调用结果:'+func);
  17. console.log('这是匿名函数调用结果:'+x(5,5));
  18. </script>
Correction status:qualified

Teacher's comments:你的博客并不只有老师在看, 还有其它的网友或学习者, 他们从这个博客中能看到什么呢? 没有注释, 没有说明, 没有总结.... 希望下次多写些
Statement of this Website
The copyright of this blog article belongs to the blogger. Please specify the address when reprinting! If there is any infringement or violation of the law, please contact admin@php.cn Report processing!
All comments Speak rationally on civilized internet, please comply with News Comment Service Agreement
0 comments
Author's latest blog post