Blogger Information
Blog 18
fans 0
comment 0
visits 7744
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
常用函数类型,常用数据类型
只如初见
Original
371 people have browsed it

常用函数类型

  1. // 1. 命名函数
  2. function getName(username) {
  3. return 'Hello ' + username;
  4. }
  5. // 2. 匿名函数
  6. let getUserName = function(username) {
  7. return 'Hello ' + username;
  8. };
  9. // 3. 箭头函数,用来简化匿名函数的声明
  10. add = () => console.log(34 + 88);

常用数据类型

  1. // 1. 原始类型: number(1), string('a'), boolean(true,false),undefined(声明了变量,但是没赋值), null
  2. // 2. 引用类型, array(数组), object(//对象), function(函数)
  3. //数组:
  4. const arr = [1, 'admin', [1, 2, 3], true];
  5. //对象
  6. let obj = {
  7. id: 1,
  8. username: 'jack',
  9. num: [1, 2, 3],
  10. isOk: true,
  11. 'my email': '498668472@qq.com',
  12. };
  13. //函数
  14. function getUser(obj) {
  15. return 'id =' + obj.id + ', username =' + obj.username;
  16. }
  17. getUser(obj);
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
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!