jQuery code to get dropdown values in comma separated list

Yesterday I needed to get all the dropdown values and create a comma separated list. One way to iterate through all dropdown elements and create string. But I found there is another way to achieve this. Use jQuery $.map() which applies a function to each item in an array or object and maps the results into a new array.
$(document).ready(function() {
    var ddlvalues = $('#ddlCars option').map(function() {
        return $(this).val();
    var ddlText = $('#ddlCars option').map(function() {
        return $(this).text();
See result below

See Complete Code
Feel free to contact me for any help related to jQuery, I will gladly help you.

Nothing shocks me, I'm a Software Engineer. And I am not young enough to know everything. I live in World Wide Web and from there take care of this website. This website communicates about my work, learning and experience. I believe life is short, and it is for loving, sharing, learning and connecting. So lets connect..