Node.js Objects

There is a given object, write node.js program to print the given object's properties, delete the second property and get length of the object.
var user = {
first_name: "John",
last_name: "Smith",
age: "38",
department: "Software"
};

Solution

Objects are one of the core workhorses of the JavaScript language, and something you will use all the time. They are an extremely dynamic and flexible data type, and you can add and remove things from them with ease.

>delete user.last_name;
>user
>Object.keys(user).length;

Read more articles


General Knowledge



Learn Popular Language