title: JavaScript's functions and objects assignment to other variables
body: <p>I was going through some practice sessions and I came to learn that in JS, functions are also object. So I tried the following.  </p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>function say() {
    console.log("hi")
  }
  var obj1 = say;
  obj1.hello = "hello";
  console.log(say.hello); // hello</code></pre>
  </div>
  </div>
  </p>
  
  <p>then I tried doing the same with an object, but got <code>undefined</code> and I expected to get <code>winter</code>.</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>var obj2 = { weather: "summer", time: "noon" };
  var name = obj2;
  name.favoriteWeather = "winter";
  console.log(name.favoriteWeather); //undefined</code></pre>
  </div>
  </div>
  </p>
  
  <p>Why JS behaves the way it does? how can I get <code>winter</code> as result from <code>name.favoriteWeather</code></p>