首页 > 编程语言 > 详细

[Javascript] Objects and Functions

时间:2020-02-25 19:35:54      阅读:53      评论:0      收藏:0      [点我收藏+]

What makes objects different is that we can create more of them. Every time we use the {} object literal, we create a brand new object value:

let shrek = {};
let donkey = {};

技术分享图片

 

Functions:

for (let i = 0; i < 7; i++) {
  let dig = function() {
    // Do nothing
  };
  console.log(dig);
}
The snippet above contains one function definition in the code, but it creates seven function values! This is why separating these concepts is important.
Every time we execute a line of code that contains a function declaration, a brand new function value appears in our universe.

[Javascript] Objects and Functions

原文:https://www.cnblogs.com/Answer1215/p/12363168.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!