Skip to content
geeksforgeeks
  • Tutorials
    • Python
    • Java
    • Data Structures & Algorithms
    • ML & Data Science
    • Interview Corner
    • Programming Languages
    • Web Development
    • CS Subjects
    • DevOps And Linux
    • School Learning
    • Practice Coding Problems
  • Courses
    • DSA to Development
    • Get IBM Certification
    • Newly Launched!
      • Master Django Framework
      • Become AWS Certified
    • For Working Professionals
      • Interview 101: DSA & System Design
      • Data Science Training Program
      • JAVA Backend Development (Live)
      • DevOps Engineering (LIVE)
      • Data Structures & Algorithms in Python
    • For Students
      • Placement Preparation Course
      • Data Science (Live)
      • Data Structure & Algorithm-Self Paced (C++/JAVA)
      • Master Competitive Programming (Live)
      • Full Stack Development with React & Node JS (Live)
    • Full Stack Development
    • Data Science Program
    • All Courses
  • Lodash-Array
  • Lodash-Collection
  • Lodash-Function
  • Lodash-Lang
  • Lodash-Math
  • Lodash-Object
  • Lodash-Sequence
  • Lodash-String
  • Lodash-Util
  • JavaScript
  • Web Technology
Open In App
Next Article:
Lodash _.create() Method
Next article icon

Lodash _.at() Method

Last Updated : 09 Sep, 2020
Comments
Improve
Suggest changes
Like Article
Like
Report
Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, collection, strings, lang, function, objects, numbers etc. The _.at() method creates an array of values corresponding to paths of object. Syntax:
_.at(object, [paths])
Parameters: This method accepts two parameters as mentioned above and described below:
  • object: It holds the object to iterate over.
  • [paths]: It holds the property paths to pick.
Return Value: This method returns the picked values. Example 1: Here, const _ = require(‘lodash’) is used to import the lodash library in the file.
javascript
// Requiring the lodash library  const _ = require("lodash");        // Original array  var object = { 'p': [{ 'q': { 'r': 7 } }, 9] };  // Using the _.at() method let at_elem = _.at(object, ['p[0].q.r', 'p[1]']);  // Printing the output  console.log(at_elem); 
Output:
  [ 7, 9 ]  
Example 2:
javascript
// Requiring the lodash library  const _ = require("lodash");        // Original array  var object = { 'oppo': [{ 'vivo': { 'moto': 1900 } }, 2400]   };  // Using the _._.at() method let at_elem = _.at(object, ['oppo[0].vivo.moto', 'oppo[1]']);  // Printing the output  console.log(at_elem); 
Output:
  [ 1900, 2400 ]  
Note: This code will not work in normal JavaScript because it requires the library lodash to be installed.

Next Article
Lodash _.create() Method

S

shivanisinghss2110
Improve
Article Tags :
  • JavaScript
  • Web Technologies
  • JavaScript-Lodash

Similar Reads

    Lodash
    Lodash is a JavaScript library that works on the top of underscore.js. It helps in working with arrays, strings, objects, numbers, etc. It provides us with various inbuilt functions and uses a functional programming approach which that coding in JavaScript easier to understand because instead of wri
    7 min read
    Lodash Introduction
    Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc. It provides us with various inbuilt functions and uses a functional programming approach that makes coding in JavaScript easier to understand because instead of
    3 min read

    Lodash Array

    Lodash _.chunk() Method
    Lodash _.chunk() function is used to break the array into small chunks. Each chunk is an array of sizes as given.Syntax:_.chunk(array, size);Parameters:array: An array to be processed by chunk function.size: This describes the size of the chunk.Return Value: It returns the array of chunks that is al
    3 min read
    Lodash _.compact() Function
    Lodash _.compact() function is used to create an array with all false values removed in JavaScript. so it returns a new array of filtered values.Syntax:_.compact(array);Parameters:array: It is an array to be compacted.Note: The values are false, null, 0, "", undefined, and NaN are falsey.Return Valu
    2 min read
    Lodash _.concat() Function
    Lodash _.concat() function is used to concatenate the arrays in JavaScript. and it returns the new concatenated array.Syntax:_.concat(array, [values]);Parameters:array: It is an array to which values are to be added.values: It is the Array of values that is to be added to the original array.Note: Th
    3 min read
    Lodash _.difference() Function
    Lodash _.difference() function is used to remove a single element or the array of elements from the original array. This function works pretty much the same as the core function of JavaScript i.e. filter.Syntax:_.difference(array, [values]);Parameters:array: It is the array from which different elem
    2 min read
    Lodash Array Complete Reference
    Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers etc. Lodash Array methods are used to perform operations on arrays using inbuild methods.Lodash Array MethodsDescription_.chunk()It is used to break the array in to s
    5 min read

    Lodash Collection

    Lodash _.countBy() Method
    Lodash _.countBy method creates an object composed of keys generated from the results of running each element of collection through iteratee. The corresponding value of each key is the number of times the key was returned by iterate. Syntax:_.countBy(collection, [iteratee=_.identity])Parameters: Thi
    3 min read
    Lodash _.every() Method
    Lodash _.every() method checks if the predicate returns true for all elements of the collection and iteration is stopped once the predicate returns falsely. Note: Also this method returns true for empty collections because everything is true for elements of empty collections. Syntax_.every(collectio
    3 min read
    Lodash _.filter() Method
    The Lodash _.filter() method iterates over a collection (array or object) and returns a new array of elements that meet a specified condition (predicate), enabling efficient data filtering and extraction.Note: This method is not similar to the _.remove() method as this method returns a new array. Sy
    3 min read
    Lodash _.find() Method
    The Lodash _.find() method searches through a collection (array or object) and returns the first element that satisfies a specified condition (predicate). It’s useful for quickly locating a matching item within a collection. If no match is found, it returns undefined.Syntax_.find(collection, predica
    2 min read
    Lodash Collection Complete Reference
    Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc. It provides us with various inbuilt functions and uses a functional programming approach which makes coding in javascript easier to understand because instead o
    3 min read

    Lodash Date

    Lodash _.now() Method
    Lodash _.now() method is used to get the timestamp of the number of milliseconds that have elapsed since the Unix epoch (1 January 1970 00:00:00 UTC). Syntax:_.now();Parameters:This method does not accept any parameter. Return Value: This method returns the timestamp. Example 1: In this example, we
    1 min read

    Lodash Function

    Lodash _.after() Method
    Lodash _.after() method is opposite of Lodash _.before() method. This method creates a function that invokes function once it’s called n or more times.Syntax:_.after(n, func);Parameters: n: This parameter holds the number n, which defines the number of calls before func is invoked.func: This paramet
    2 min read
    Lodash _.ary() Method
    Lodash _.ary() method is used to create a function that invokes the given function, up to n arguments, ignoring any additional arguments.Syntax:_.ary( func, n )Parameters: This method accepts two parameters as mentioned above and described below:func: This parameter holds the function which will cap
    2 min read
    Lodash _.before() Method
    Lodash _.before() method is the opposite of the Lodash _.after() method. This method is used to create a function that invokes func with the binding and arguments of the created function, while it’s called less than n times.Syntax:_.before(n, func);Parameters: n: This parameter holds the number n, w
    2 min read
    Lodash _.bind() Method
    Lodash _.bind() method is used to create a function that invokes the given function with the binding of thisArg and it is used to bind a function to an object. When the function is called, the value of this will be the object. The _.bind.placeholder value, which defaults to _ in monolithic builds, m
    2 min read
    Lodash Function Complete Reference
    Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc. It provides us with various inbuilt functions and uses a functional programming approach which makes coding in javascript easier to understand because instead o
    2 min read

    Lodash lang

    Lodash _.castArray() Method
    Lodash _.castArray() method is used to cast value into an array if it is not an array.Syntax: _.castArray(value);Parameters:  value: This parameter holds the value that needs to be inspected.Return Value:It returns an array with the including value passed in the _.castArray().Example 1: In this exam
    2 min read
    Lodash _.clone() Method
    Lodash _.clone() method is used to create a shallow copy of the value. This method supports cloning arrays, array buffers, booleans, date objects, maps, numbers, Object objects, regexes, sets, strings, symbols, and typed arrays. It is loosely based on the structured clone algorithm. Syntax:_.clone(v
    2 min read
    Lodash _.conformsTo() Method
    Lodash _.conformsTo() method is used to check if the given object conforms to the given source by invoking the predicate properties of the source with the corresponding property values of the object. It returns true if it conforms, else false.Syntax:_.conformsTo( object, source );Parameters: object:
    2 min read
    Lodash _.eq() Method
    Lodash _.eq() method is used to find whether the two values are equivalent or not by performing the SameValueZero comparison. It returns true if the values are equivalent. Otherwise, it returns false.Syntax:_.eq(value, other);Parameters: value: This parameter holds the value to compare.other: This p
    2 min read
    Lodash Lang Complete Reference
    Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc. It provides us with various inbuilt functions and uses a functional programming approach which makes coding in JavaScript easier to understand because instead o
    4 min read

    Lodash Math

    Lodash _.add() Method
    Lodash _.add() method is used to add two numbers. Syntax:_.add(augend, addend);Parameters:augend: This parameter holds the first number in addition.addend: This parameter holds the second number in addition.Return Value: This method returns the result of adding two numbers. Example 1: In this exampl
    1 min read
    Lodash _.ceil() Method
    Lodash _.ceil() method is used to compute numbers rounded up to precision.Syntax:_.ceil(number, [precision = 0]);Parameters: number: This parameter holds the number to round up.[precision=0]: This parameter holds the precision to round up to.Return Value: This method returns the rounded-up number.Ex
    2 min read
    Lodash _.divide() Method
    Lodash _.divide() method is used to divide two numbers.Syntax:_.divide(dividend, divisor);Parameters: dividend: This parameter holds the first number in a division.divisor: This parameter holds the second number in a division.Return Value: This method returns the quotient after dividing two numbers.
    2 min read
    Lodash _.floor() Method
    Lodash _.floor() method is used to compute numbers rounded down to precision means it rounded down to the floor value.Syntax:_.floor(number, [precision = 0])Parameters: This method accepts two parameters as mentioned above and described below:number: This parameter holds the number to round down.[pr
    2 min read
    Lodash Math Complete Reference
    Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, strings, objects, numbers, etc. It provides us with various inbuilt functions and uses a functional programming approach which makes coding in javascript easier to understand because instead o
    2 min read

    Lodash Number

    Lodash _.clamp() Method
    Lodash _.clamp() method is used to clamp numbers within the inclusive range within the lower and upper bounds. Syntax:_.clamp(number, lower, upper);Parameters: number: This parameter holds the number to clamp.lower: This parameter holds the lower bound.upper: This parameter holds the upper bound.Ret
    1 min read
    Lodash _.inRange() Method
    The _.inRange() method in Lodash is a utility function that checks if a given number is within a specified range. It’s a simple yet useful method for determining whether a number falls within a specified range. This function is particularly helpful when you need to perform conditional checks based o
    2 min read
    Lodash _.random() Method
    Lodash _.random() method is used to return a random number that is in the range provided to the function. If floating is true, or either lower or upper are floats, a floating-point number is returned instead of an integer. Syntax:_.random([lower = 0], [upper = 1], [floating]);Parameters: lower: This
    1 min read

    Lodash Object

    Lodash _.assign() Method
    Lodash _.assign() method is used to assign the enumerable string keyed properties of the given source objects to the destination objects. The source objects are applied from left to right and any subsequent sources overwrite the property assignments of the previous sources. Syntax:_.assign( dest_obj
    1 min read
    Lodash _.assignIn() Method
    Lodash _.assignIn() method is like the _.assign() method except that it iterates over its own and inherited source properties. Subsequent source objects overwrite property assignments of previous sources. This method mutates the object. Syntax:_.assignIn( dest_object, [src_obj]);Parameters: dest_obj
    1 min read
    Lodash _.at() Method
    Lodash is a JavaScript library that works on the top of underscore.js. Lodash helps in working with arrays, collection, strings, lang, function, objects, numbers etc. The _.at() method creates an array of values corresponding to paths of object. Syntax: _.at(object, [paths]) Parameters: This method
    2 min read
    Lodash _.create() Method
    Lodash _.create() method creates an object that inherits from the prototype object. If a properties object is given, its own enumerable string keyed properties are assigned to the created object. Syntax:_.create( proto_obj, property_object);Parameters: proto_obj: This is the object to inherit from.p
    1 min read
    Lodash Object Complete Reference
    Lodash is a JavaScript utility library built on top of Underscore.js. It simplifies working with arrays, strings, objects, numbers, and more. Lodash provides a wide range of built-in object functions that allow you to easily access and perform operations on objects, making object manipulation more e
    4 min read
geeksforgeeks-footer-logo
Corporate & Communications Address:
A-143, 7th Floor, Sovereign Corporate Tower, Sector- 136, Noida, Uttar Pradesh (201305)
Registered Address:
K 061, Tower K, Gulshan Vivante Apartment, Sector 137, Noida, Gautam Buddh Nagar, Uttar Pradesh, 201305
GFG App on Play Store GFG App on App Store
Advertise with us
  • Company
  • About Us
  • Legal
  • Privacy Policy
  • In Media
  • Contact Us
  • Advertise with us
  • GFG Corporate Solution
  • Placement Training Program
  • Languages
  • Python
  • Java
  • C++
  • PHP
  • GoLang
  • SQL
  • R Language
  • Android Tutorial
  • Tutorials Archive
  • DSA
  • Data Structures
  • Algorithms
  • DSA for Beginners
  • Basic DSA Problems
  • DSA Roadmap
  • Top 100 DSA Interview Problems
  • DSA Roadmap by Sandeep Jain
  • All Cheat Sheets
  • Data Science & ML
  • Data Science With Python
  • Data Science For Beginner
  • Machine Learning
  • ML Maths
  • Data Visualisation
  • Pandas
  • NumPy
  • NLP
  • Deep Learning
  • Web Technologies
  • HTML
  • CSS
  • JavaScript
  • TypeScript
  • ReactJS
  • NextJS
  • Bootstrap
  • Web Design
  • Python Tutorial
  • Python Programming Examples
  • Python Projects
  • Python Tkinter
  • Python Web Scraping
  • OpenCV Tutorial
  • Python Interview Question
  • Django
  • Computer Science
  • Operating Systems
  • Computer Network
  • Database Management System
  • Software Engineering
  • Digital Logic Design
  • Engineering Maths
  • Software Development
  • Software Testing
  • DevOps
  • Git
  • Linux
  • AWS
  • Docker
  • Kubernetes
  • Azure
  • GCP
  • DevOps Roadmap
  • System Design
  • High Level Design
  • Low Level Design
  • UML Diagrams
  • Interview Guide
  • Design Patterns
  • OOAD
  • System Design Bootcamp
  • Interview Questions
  • Inteview Preparation
  • Competitive Programming
  • Top DS or Algo for CP
  • Company-Wise Recruitment Process
  • Company-Wise Preparation
  • Aptitude Preparation
  • Puzzles
  • School Subjects
  • Mathematics
  • Physics
  • Chemistry
  • Biology
  • Social Science
  • English Grammar
  • Commerce
  • World GK
  • GeeksforGeeks Videos
  • DSA
  • Python
  • Java
  • C++
  • Web Development
  • Data Science
  • CS Subjects
@GeeksforGeeks, Sanchhaya Education Private Limited, All rights reserved
We use cookies to ensure you have the best browsing experience on our website. By using our site, you acknowledge that you have read and understood our Cookie Policy & Privacy Policy
Lightbox
Improvement
Suggest Changes
Help us improve. Share your suggestions to enhance the article. Contribute your expertise and make a difference in the GeeksforGeeks portal.
geeksforgeeks-suggest-icon
Create Improvement
Enhance the article with your expertise. Contribute to the GeeksforGeeks community and help create better learning resources for all.
geeksforgeeks-improvement-icon
Suggest Changes
min 4 words, max Words Limit:1000

Thank You!

Your suggestions are valuable to us.

What kind of Experience do you want to share?

Interview Experiences
Admission Experiences
Career Journeys
Work Experiences
Campus Experiences
Competitive Exam Experiences