JS log object why is showing [object Object]

后端 未结 3 724
天涯浪人
天涯浪人 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条回答
  •  庸人自扰
    2020-11-29 10:15

    You are concatenating an object to string

    You can console a string and an object by separating it by comma(,)

    you can console.log("uniqueProducts:", uniqueProducts );

提交回复
热议问题