Ver Fonte

object array operation done

night-cherry há 1 mês atrás
pai
commit
9e4f7aea5e
1 ficheiros alterados com 15 adições e 1 exclusões
  1. 15 1
      index.js

+ 15 - 1
index.js

@@ -100,6 +100,7 @@ const app=createApp({
         console.log("res[0].author :"+res[0].author);
         console.log("res[0].publisher :"+res[0].publisher);
         console.log("res[0].pages :"+res[0].pages);
+        console.log("res[1]:"+res[1]);
         console.log("res[1][\"title\"] :"+res[1]["title"]);
         console.log("res[1][\"author\"] :"+res[1]["author"]);
         console.log("res[1].publisher :"+res[1].publisher);
@@ -109,7 +110,20 @@ const app=createApp({
         
         console.log("------  _books : "+_books);
         // console.log("------this.books : "+this.books);
-        _books.add(res[0]);
+        try{
+          _books.push(res[0]);
+        }catch(e){
+          console.log("the way == _books.push(res[0])  is wrong!!!");
+          try{
+            _books.concat(res);
+
+          }catch(e){
+            console.log("the way == _books.push(res[0])  is wrong!!!");
+          }
+        }finally{
+          console.log("--object array operation done--");
+
+        }
       
         // console.log("------books : "+books);
         // console.log("------this : "+this);