Hello!
Sorry to bother for newb thing but I am unable to solve.
I have return below in to function node to perform subtraction between first and last element of array. it returns length and whole array but there is something wrong with var one=Firstagg2.payload[0]; and var last= Firstagg2.payload[newMsg-1]; I have right to get first and last element. It doesn't return anyone of it and hence subtraction.
Please Help me with this!
var newMsg = { payload: msg.payload.length };
//return [newMsg, msg];
var Firstagg2 = { payload: msg.payload };
//return Firstagg2;
var one=Firstagg2.payload[0];
var last= Firstagg2.payload[newMsg-1];
msg = last-one;
return msg;