Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

javascript pluck

Example 1:

 <script type="text/javascript">
          var list = [{name: 'jack', age: 14}, {name: 'jill', age: 15},
                             {name: 'humpty', age: 16}];
          console.log(_.pluck(list, 'age'));
    </script>
    

Example 2:

 <script type="text/javascript">
         var goal  = [
        {
            "category" : "other",
            "title" : "harry University",
            "value" : 50000,
            "id":"1"
        },
        {
            "category" : "traveling",
            "title" : "tommy University",
            "value" : 50000,
            "id":"2"
        },
        {
            "category" : "education",
            "title" : "jerry University",
            "value" : 50000,
            "id":"3"
        },
        {    
            "category" : "business",
            "title" : "Charlie University",
            "value" : 50000,
            "id":"4"
        }
    ]
    console.log(_.pluck(goal, 'category'));
    </script>
 
PREVIOUS NEXT
Tagged: #javascript #pluck
ADD COMMENT
Topic
Name
5+4 =