如果我有一个对象数组 Array 1:[Object 1, Object 2, Object 3]
并且每个对象如下所示:
object 1 has properties : creation date, name, class, size where name = Bear
object 2 has properties : creation date, name, class, size where name = Dog
object 3 has properties : creation date, name, class, size where name = Guerilla
我想根据它们各自的名称按字母顺序对这些对象进行排序,因此数组 2如下所示[Object 1 (Bear), Object 2 (Dog), Object 3 (Guerilla)]
我将如何在 Javascript 中解决这个问题?有没有方便的方法来做到这一点?我对 JS 比较陌生。先感谢您!