You wrapped your class (constructor function)
Vegetable with another function
makeClass. For better understanding I’ll use real world analogy. Imagine function is a box and people normally put useful stuff or functionality inside. Imagine that browsers are people of different age depending on version of browser. So now, taking that into consideration here’s step-by-step guide of your code:
- You have magic constructor-box - whenever you open it there’s a vegetable inside!
- Problem with that box - it cannot be opened by really old people (we’re talking 100yr+ here)
- So what you do, you put your
Vegetable box inside another box and put small piece of paper
use strict which means only for people 100 year-old or less.
- Then action time, you open one box and open another box
The moral of this story is, do you really need that second box? Have you even seen 100+ year-old people?