Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

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}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #delete #properties #javascript #object
ADD COMMENT
Topic
Name
7+5 =