Assign them:
var compDate = eventDateData.compDate,
compDateEnd = eventDateData.compDateEnd;
Domanda
I am using big commerce and in that there is a product end date and start date . I wanted to get the end date and start date from a kind of value is returning when the product page loads . The values come as
var eventDateData = {type:'3',compDate:'2014/04/18',compDateEnd:'',invalidMessage:'Please choose a valid product listing end date first.',errorMessage:'The product listing end date must be on or before 18th Apr 2014.'};
this variable is coming from big commerce . How can i take out the date compDate
and compDateEnd
in two separate variables ?
Soluzione
Assign them:
var compDate = eventDateData.compDate,
compDateEnd = eventDateData.compDateEnd;
Altri suggerimenti
You can simply access it using .
(simple dot-notation)
console.log(eventDateData.compDate);
console.log(eventDateData.compDateEnd);