Autor | Zpráva | ||
---|---|---|---|
robbie Profil * |
#1 · Zasláno: 16. 8. 2014, 10:30:50
Pomuže prosím nekdo s vyvětlením funkce ve scriptu, nejde mi moc do hlavy proč je zde použito .contructor a indexOf(), jaký to má význam.
V tutorialu píší: function always return true if the argument is an array. Or more precisely: it returns true if the object prototype of the argument is "[object array]". ale co je to ten object prototype, co si pod tím predstavit. Děkuji za radu <script> var fruits = ["Banana", "Orange", "Apple", "Mango"]; document.getElementById("demo").innerHTML = isArray(fruits); function isArray(myArray) { return myArray.constructor.toString().indexOf("Array") > -1; } </script> |
||
juriad Profil |
|||
Časová prodleva: 11 let
|
0