批改状态:合格
老师批语:
function getName(username) {return "Hello " + username;}console.log(getName("猪老师"));
let f1 = function (a, b) {return a + b;};console.log(f1(10, 20));
(function (username) {console.log("Hello " + username);})("灭绝老师");
const getUserName = function (username) {return "Hello " + username;};
let f1 = function (a, b) {return a + b;};
可以简化成f1=(a,b)=>a+b
可以简化成f2=name=>”hello”+name
f2=function(name){return "hello"+name};
const arr = ["手机", 2, 5000];console.log(arr[0]);console.log(arr[1]);console.log(arr[2]);
let obj={name:"phone",price:500,num:5000}console.log(obj.name, obj.num, obj.price);
function f1(callback) {// 参数 callback 是一个函数console.log(callback());}f1(function () {return "Hello 朱老师";});
function f2() {let a = 1;return function () {return a++;};}console.log(f2());const f = f2();console.log(f);console.log(f());console.log(f());console.log(f());console.log(f());console.log(f());console.log(f());
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号