Creating a object possible or not ?

Alex Lord
Alex Lord used Ask the Experts™
on
wondering how i can turn these results into objects.

console log view

code view -

  for(var i = 0; i < response.notes.length; i++){

        var d = new Date(parseInt(response.notes[i]['date'])*1000);
        var day = d.getDate();
        var month = d.getMonth();
        var year = d.getFullYear();
    
        console.log(d);
        console.log("Day " + day);
        console.log("Month " + month); 
        console.log("Year " + year);
        console.log("");
     
        
        }//for

Open in new window


would it be possible to store these as objects ? every try has failed and not sure if i can or not,
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
What about using JSON?
var results =  [] ;

for(var i = 0; i < response.notes.length; i++){
{
// your code block
        var d = new Date(parseInt(response.notes[i]['date'])*1000);
///
 var obj = { 
        Text: d,
        day : d.getDate(),
        month : d.getMonth(),
        year : d.getFullYear()
    };
 results .push(obj);
}

Open in new window

Author

Commented:
Hey Misha

This worked thank you.

Commented:
Glad to help you!

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial