? call ternary operator is shorcut for, "if statement".
// below we make object with key id, and assign it a value from body.id.
// if body.id is null it will return false and it will assign it res.id value.
{ id: body.id? body.id : res.id }
// we can write it in if statement like this
if(body.id){
return {id:body.id}
}else{
return {id:res.id}
}
// JavaScript Unary Operators The unary plus operator (+)
// The unary plus ( + ) precedes its operand and evaluates to its operand. It attempts to convert the operand to a number, if it isn't already.
+42 // 42
+"42" // 42
+true // 1
+false // 0
+null // 0
+undefined // NaN
+NaN // NaN
+"foo" // NaN
+{} // NaN
+function(){} // NaN
// Note that attempting to convert an array can result in unexpected return values.
// In the background, arrays are first converted to their string representations:
[].toString() === '';
[5].toString() === '5';
[1, 2].toString() === '1,2';
// The operator then attempts to convert those strings to numbers:
+[] // 0 ( === +'' )
+[5] // 5 ( === +'5' )
+[1, 2] // NaN ( === +'1,2' )