JSON.stringify(`on1:true ,DTime:n, Time: s, b : s`)

If you are asking a question, please follow this template:

  1. My goal is: [ “on1:true ,DTime:10, Time: 15, 11/27/20:15”]
  2. My actions are:
  let now = Timer.now();
  let a = Timer.fmt('%H:%M:%S', now);
  print(a);
   

   if(value===1 ){
   
    count=count+1;
    n=n+1;
    s = Timer.fmt("%H:%M:%S.", n);
    print(s);
   let  b = JSON.stringify(Timer.fmt('%D', now));
    print(n);
    print(b);
msg =JSON.stringify({on1:true ,DTime:n, Time: s, b : s });

i have even tried
(JSON.stringify(on1:${true} ,DTime:${n}, Time: ${s}, ${b}:${s} )); but this is not working

  1. The result I see is:
[{"on1":true,"DTime":10,"Time":15,"b":15}]
  1. My expectation & question is: [how can i get current date in place of b ]

You are stringifying already stringified objects. I mean your ‘b’. Didn’t you notice that ?
E.g.:

JSON.stringify({
    total_ram: Sys.total_ram(),
    free_ram: Sys.free_ram()
  });

i want b as 11/27/20

That’s what Timer.fmt('%D', now) does.