Answers for "delete all properties from an javascript object"

0

delete all properties from an javascript object

req.session.user = { name: 'Alexander' };  // we store an object in the session
var session = req.session;                 // save reference to the session in a variable
console.log( req.session, session );       // {user: Object}, {user: Object}

req.session = {};                          // let's replace session with a new object
console.log( req.session, session );       // {}, {user: Object}
Posted by: Guest on July-19-2021

Code answers related to "delete all properties from an javascript object"

Browse Popular Code Answers by Language