jquery - $.map - returning element not appending properly
<p>using $.map function i am looping a object and appending the element i make. but my case, i am getting the console info properly, but finally returning object only appending, what is the issue in my code?</p>

<p>my code :</p>

<pre><code>  $('body').append(
 $.map(val.fields, function (val, i) {
     var element;
     if (val.label) {
         element = $('&lt;label /&gt;', {
             text: val.label
         });
         console.log(element); //properly consoles 3 lables but not appending why?
     }
     if (val.type) {
         element = val.type === 'text' || val.type === 'submit' ? $('&lt;input /&gt;', {
             type: val.type,
             name: val.name,
             value: val.value,
             id: val.vlaue
         }) : val.type === 'select' ? $('&lt;select /&gt;', {
             name: val.name
         }) : '';
         console.log(element); // properly console 3 element and only this is appending
     }

     return element;
 }))
</code></pre>
