Default values for Vue component props & how to check if a user did not set the prop?
<p><strong>1.</strong> How can I set the default value for a component prop in Vue 2? For example, there is a simple <code>movies</code> component that can be used in this way:</p>

<pre><code>&lt;movies year="2016"&gt;&lt;movies&gt;



Vue.component('movies', {
    props: ['year'],

    template: '#movies-template',
    ...
}
</code></pre>

<p>But, if a user doesn't specify the <code>year</code>:</p>

<pre><code>&lt;movies&gt;&lt;/movies&gt;
</code></pre>

<p>then the component will take some default value for the <code>year</code> prop.</p>

<p><strong>2.</strong> Also, what is the best way to check if a user did not set the prop? Is this a good way:</p>

<pre><code>if (this.year != null) {
    // do something
}
</code></pre>

<p>or maybe this:</p>

<pre><code>if (!this.year) {
    // do something
}
</code></pre>

<p><strong>?</strong></p>