Lodash _.keys() and _.values() Example

The _.keys() function returns an array of the property names of the JavaScript object and the _.values() function returns an array of their values.

Learn Lodash JS at Lodash JS Tutorial with Examples.

Lodash _.keys() and  _.values() Example

<!DOCTYPE html>
    <title>Lodash Tutorial</title>
    <script src="https://cdn.jsdelivr.net/npm/lodash@4.17.11/lodash.min.js"></script>

    <script type="text/javascript">
        // using Object Literals
        var user = {
            firstName: 'Ramesh',
            lastName: 'Fadatare',
            emailId: 'ramesh@gmail.com',
            age: 29,
            getFullName: function () {
                return user.firstName + " " + user.lastName;

        const keys = _.keys(user);

        const values = _.values(user);
["firstName", "lastName", "emailId", "age", "getFullName"]
["Ramesh", "Fadatare", "ramesh@gmail.com", 29, ƒ]


Free Spring Boot Tutorial - 5 Hours Full Course

Watch this course on YouTube at Spring Boot Tutorial | Fee 5 Hours Full Course