码迷,mamicode.com
首页 > 编程语言 > 详细

[Javascript] Objects and Functions

时间:2020-02-25 19:49:14      阅读:82      评论:0      收藏:0      [点我收藏+]

标签:cells   技术   dig   i++   appear   ever   str   image   imp   

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

标签:cells   技术   dig   i++   appear   ever   str   image   imp   

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

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!