Computer >> Computer tutorials >  >> Programming >> Javascript

How to access methods of an array of objects in JavaScript?


To access methods of an array of objects in JavaScript, you can try to run the following code, wherein the method is accessed:

Example

<html>    
   <head>      
      <title>JavaScript Array join Method</title>    
   </head>        
   <body>          
      <script>          
         var arr = new Array("First","Second","Third");                    
         var str = arr.join();          
         document.write("str : " + str );                    
         var str = arr.join(", ");          
         document.write("<br />str : " + str );                  
      </script>          
    </body>
</html>                                                                                

Output

str : First,Second,Third
str : First, Second, Third