JS log object why is showing [object Object]

后端 未结 3 722
天涯浪人
天涯浪人 2020-11-29 09:50

In JS, if I log a string to the console it is not showing properly ?

console.log(uniqueProducts); //
console.log(\"uniqueProducts:\"+uniqueProducts);
         


        
3条回答
  •  萌比男神i
    2020-11-29 10:31

    + concatenates strings but object is not a string.

    Use console.dir(obj) to display the content of the object.

提交回复
热议问题