I am trying to console.log("ctx : "+ ctx.request.body); To view what is in the JSON that received when tried it shows ctx : [object Object].
But if I console.log("ctx : ", ctx.request.body); like this it prints the JSON correctly without + in console.log(). I want to know what is the reason behind this logic
When you use
someString + someObject, when the result is a new string. The object must be converted to a string first before the new string can be created.Whenever an object is cast to a string in Javascript, the result is
[object Object].To see this behavior you can also.