Node.js prompt.addProperties() Method Last Updated : 25 Oct, 2020 Summarize Comments Improve Suggest changes Share Like Article Like Report The prompt.addProperties() method is an asynchronous function and this method is used to add properties to an existing object from the command line. This function is used for I/O operations. Syntax: prompt.addProperties(object, Array[keys], callbackfunction) Parameters: This method takes three parameters as shown below: object: The first parameter is an object which is predefined in the program.Array: The second parameter is the keys to the given object.callback function: callback function to make this function is an asynchronous function. Installation Module: You can visit the link to Install this module. You can install this package by using this command. npm install prompt After that, you can just create a folder and add a file for example, index.js. To run this file you need to run the following command. node index.js Project: Filename index.js javascript const prompt = require('prompt'); // Start the prompt prompt.start(); // Create an object const user = { name: 'GFG', country: 'India' }; // Extending the `user` object prompt.addProperties(user, ['email', 'age'], (err, user) => { if (err) { throw err; } // Printing modified object console.log(user); }); Step to run this program: Run the index.js file using the following command: node index.js Input: [email protected] prompt: age: 12 Output: prompt: email: [email protected] prompt: age: 12 { name: 'GFG', country: 'India', email: '[email protected]', age: '12' } Comment More infoAdvertise with us Next Article Node.js prompt.addProperties() Method Z zack_aayush Follow Improve Article Tags : Web Technologies Node.js Write From Home Node.js-Methods Similar Reads Node.js prompt.get() Method The prompt.get() method is an asynchronous function. This method takes strings representing property names in addition to objects for complex property validation (and more). This function is used for I/O operations. Syntax: prompt.get([object]/[properties name], callbackfunction) Parameters: This me 1 min read Node.js fs.promises.appendFile() Method The fs.promises.appendFile() method of File System module in Node.js is used to interact with the hard disk of the user's computer. The appendFile() method is used to append new data into the existing file or if the file does not exist then file is created first and after that given data is appended 4 min read JavaScript Object defineProperties() Method The Object.defineProperties() method in JavaScript is a standard built-in Object that defines a new or modifies existing properties directly on an object and it returns the object.Syntax:Object.defineProperties(obj, props) Parameters:Obj: This parameter holds the object on which the properties are g 2 min read Node.js util.format() Method The util.format() (Added in v0.5.3) method is an inbuilt application programming interface of the util module which is like printf format string and returns a formatted string using the first argument. The formatted string contains zero or more format specifiers in which the corresponding argument v 5 min read Node.js console.profile() Method The console module provides a simple debugging console that is provided by web browsers which export two specific components: A Console class that can be used to write to any Node.js stream. Example: console.log(), console.error(), etc.A global console that can be used without importing the console. 2 min read Like