Blogger Information
Blog 25
fans 0
comment 0
visits 10626
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
JS中变量常量与函数的声明与使用过程
PHui
Original
292 people have browsed it
  1. console.log("--------常量--------");
  2. const userName = "Mrs Wang";
  3. console.log("userName:" + userName);
  4. console.log("--------变量--------");
  5. let testPath = {
  6. uid: 1,
  7. username: "test",
  8. };
  9. console.table(testPath);
  10. console.log("-------命名函数-------");
  11. function sum(a, b) {
  12. return "a + b = " + (a + b);
  13. }
  14. console.log(sum(2, 3));
  15. console.log("-------匿名函数-------");
  16. const sum2 = function (a, b) {
  17. return "a + b = " + (a + b);
  18. };
  19. console.log(sum2(2, 3));
  20. console.log("-------箭头函数-------");
  21. const sum3 = (a, b) => {
  22. return "a + b = " + (a + b);
  23. };
  24. console.log(sum2(2, 3));
  25. console.log("-------立即执行-------");
  26. let sum4 = (function (a, b) {
  27. return "a + b = " + (a + b);
  28. })(2, 3);
  29. console.log(sum4);

Correcting teacher:PHPzPHPz

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