[Javascript] Objects and Functions

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.
原文地址:https://www.cnblogs.com/Answer1215/p/12363168.html