How to list the properties of a JavaScript object?

后端 未结 17 2805
刺人心
刺人心 2020-11-22 00:34

Say I create an object thus:

var myObject =
        {\"ircEvent\": \"PRIVMSG\", \"method\": \"newURI\", \"regex\": \"^http://.*\"};

What is

17条回答
  •  孤城傲影
    2020-11-22 01:14

    Could do it with jQuery as follows:

    var objectKeys = $.map(object, function(value, key) {
      return key;
    });
    

提交回复
热议问题