首页 » JavaScript » 正文

一个js的小demo

2021-2-26 ·  1,518 views  ·  0 replies 
function sayHi(person) {
  const name = person.name;
  setTimeout(() => {
    alert('Hello, ' + name);
  }, 3000);
}

let someone = { name: 'Dan' };
sayHi(someone);

someone = { name: 'Yuzhi' };
sayHi(someone);

someone = { name: 'Dominic' };
sayHi(someone);

上面的这个例子中,浏览器会发生什么?

«上一篇: :下一篇»
  1. 还没有任何评论,你来说两句吧

Leave a reply