can someone tel me how to achieve this...
entry=["start":"07:00 pm","end":"07:45 pm","rule":
"**MO,WE**","summary":"test1"]
***into***
array=[
{"start":"07:00 pm","end":"07:45 pm","rule":"MO,WE","summary":"test1","day":"**WE**"},
{"start":"07:00 pm","end":"07:45 pm","rule":"MO,WE","summary":"test1","day":"WE"(instead it should be '**MO**'}]
here is the code i tried for getting entry.day... but it didn't work...
var temprule=entry.rule;//"MO,WE"
var rulest =[];
rulest=temprule.split(',');
for(var j = 0; j < rulest.length; j++) {
var obj1 = Object.assign(rulest[j]);
entry.day=obj1; //getting only WE each time when the array passes
jsondata.push(entry); // it has all elements like start,end,summary,rule and we need to add day to this...
}
I am not sure why it keeps adding same value in day thou its looped:( is that achievable thru code ? .. Thanks
via TTT
No comments:
Post a Comment