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

JavascriptWeb DevelopmentFront End Technology

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

Example

Live Demo

<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
raja
Published on 22-Apr-2018 17:57:14
Advertisements