search

Home  >  Q&A  >  body text

javascript - Questions about tostring conversion

三叔三叔2816 days ago930

reply all(4)I'll reply

  • 扔个三星炸死你

    扔个三星炸死你2017-07-05 10:58:24

    reply
    0
  • 欧阳克

    欧阳克2017-07-05 10:58:24

    Objects cannot be alerted directly to see the things inside the object. You can use for (key in obj){alert(key + ':' + obj[key]) to see things}

    reply
    0
  • PHP中文网

    PHP中文网2017-07-05 10:58:24

    Because what you output is an object, the objects popped up by alert are all object objects. You write alert(JSON.stringify(obj)) like this, otherwise use JSON.parse(obj)

    reply
    0
  • 世界只因有你

    世界只因有你2017-07-05 10:58:24

    The parameter type in alert() is character type. When the incoming data type is incorrect, the toString() method will be automatically called for implicit conversion.
    So the full form of alert(obj) here is:
    alert(Object.prototype.toString().call(obj))
    This involves using the call method for type detection,
    You can refer to: https://developer. mozilla.org...

    reply
    0
  • Cancelreply