How to iterating over arrays and objects with jQuery.each?

How to iterating over arrays and objects with jQuery.each?, someone asked me to explain?

Array and object provide $.each() method() for itration.We can iterate or loop over each element in an array or attribute of an object.


    <meta name="viewport" content="width=device-width" />
    <title>to iterating overarrays and objects with jQuery.each</title>
    <script src="//code.jquery.com/jquery-1.10.2.js"></script>
    <script type="text/javascript">
       $(document).ready(function () {
            var months = ['office', 'excel', 'outlook', 'powerpoint', 'one note',
'one drive', 'puplisher'];
           $.each(months, function (index, value) {
               $('#microsoft').append('<li>' + value + '</li>');
            var days = {
               Sunday: 1, Monday: 2, Tuesday: 3, Wednesday: 4,
               Thursday: 5, Friday: 6, Saturday: 7
           $.each(days, function (key, value) {
               $('#week').append('<li>' + key + ' (' + value + ')</li>');
    <style type="text/css">
        div {
            display: inline-block;
            float: left;
            color: #fff;
            font-size: 18px;
            padding-left: 5px;
       .first {
            width: 150px;
            height: 200px;
            background: red;
        .second {
            width: 200px;
            height: 200px;
            background: lightgreen;
    <div class="first" id="microsoft">microsoft products</div>
    <div class="second" id="week">week days</div>


iterating over arrays and objects with jQuery.each

Post your comments / questions