Core Java| JSP| Servlets| XML| EJB| JEE5| Web Services| J2ME| Glossary| Questions?

 

 

 

 

 

 

 

 

 

 

 

 

 

Search Tutorials

Latest Questions
Comments
 
JavaScript array map 
 

In this Tutorial we want to describe you a code that help you in understanding JavaScript array map.

 

JavaScript array map

                         

In this Tutorial we want to describe you a code that help you in understanding JavaScript array map. For this we are using a JavaScript language as script language. The function name functionmakeplural accept single as parameter variable, the variable single accept the list of  value and store in it. Finally the document .write ( ) method print all the list of element in a singular form. The for loop evaluate the length of the element in singular form and the document. write print the length of element. The Single variable map the singular element to plural and store in variable plural. The document.write print the element in plural form. The for loop return you the number of times your script runs and the length of the plural element in the list printed by the docment.write ( ) method.

Arraymap.html

<html>
    <head>
        <title>Array Map</title>
        
    </head>
    <body>
        <script language="javascript" type="text/javascript">
            function makePlural(single)
            {
                return single.replace(/o/g, "e");
            }
            var singles = ["Foot""Goose""Moose","Choose","Toose"];
            document.write("<b>"+"Elements in singular form are: "+"</b>"+"<br>");
            document.write("======================"+"<br>");
            for(var i=0;i<singles.length;i++){
                document.write(singles[i]+"<br>");
            }
            var plural = singles.map(makePlural);
             document.write("<b>"+"Elements in Plural form are: "+"</b>"+"<br>");
             document.write("======================"+"<br>");
            for(var i=0;i<plural.length;i++){
                document.write(plural[i]+"<br>");
            }
        </script>
    </body>
</html>

Output of the program

Download Source code

                         

» View all related tutorials
Related Tags: java c mac process io virtual vi number this sso ai processor to proc e il section machine ce in

Leave your comment:

Name:

Email:

URL:

Title:

Comments:


Enter Code:

Audio Version
Reload Image
 

Note: Emails will not be visible or used in any way, and are not required. Please keep comments relevant. Any content deemed inappropriate or offensive may be edited and/or deleted.

No HTML code is allowed. Line breaks will be converted automatically. URLs will be auto-linked. Please use BBCode to format your text.

Add This Tutorial To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Training Courses
Tell A Friend
Your Friend Name
Software Solutions
Least Viewed
Most Rated
Recently Viewed
Search Tutorials

 

 
 

Home | JSP | EJB | JDBC | Java Servlets | WAP  | Free JSP Hosting  | Search Engine | News Archive | Jboss 3.0 tutorial | Free Linux CD's | Forum | Blogs

About Us | Advertising On RoseIndia.net  | Site Map

India News

Indian Software Development Company | iPhone Development Company in India | Flex Development Company in India | Java Training Delhi | Java Training at Noida |

Send your comments, Suggestions or Queries regarding this site at roseindia_net@yahoo.com.

Copyright © 2008. All rights reserved.