Is there an __repr__ equivalent for javascript?

前端 未结 8 1955
梦谈多话
梦谈多话 2020-12-05 13:32

The closest I got to something close to Python\'s repr is this:

function User(name, password){
         this.name = name;
         this.pass         


        
8条回答
  •  情深已故
    2020-12-05 14:04

    String(user)
    

    Is the best I can think of. I think another alternative may be to find a 3rd party lib that handles creating human readable presentation for objects.

提交回复
热议问题