search

Home  >  Q&A  >  body text

javascript - What does this JS statement mean?

What does this JS statement mean?

    var aa= {},
        bb= [{name: 'aa1'},{name: 'aa2'}];

code above.

淡淡烟草味淡淡烟草味2742 days ago521

reply all(2)I'll reply

  • PHP中文网

    PHP中文网2017-05-19 10:26:04

    is equivalent to

    var aa = {};
    var bb = [{name: 'aa1'},{name: 'aa2'}];

    is equivalent to

    var aa;
    var bb;
    aa = {};
    bb = [{name: 'aa1'},{name: 'aa2'}];

    Initialize aa as an empty object and bb as an array containing two objects

    reply
    0
  • 给我你的怀抱

    给我你的怀抱2017-05-19 10:26:04

    Declare that aa is an empty object, bb is an array, and there are two objects in the array whose attributes are name and whose values ​​are aa1 and aa2 respectively

    reply
    0
  • Cancelreply