首页 » JavaScript » 正文

一个js的小demo

发表于: PHP,JS,Golang,Shopify学习交流博客 – 咪啪咪啪的小木屋 · 2021-2-26 ·  284 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);

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

«上一篇: :下一篇»

0 thoughts on “一个js的小demo”

  1. 还没有任何评论,你来说两句吧

Leave a reply