Javascript examples for Array Operation:Array Index
Access array item from a function wrapper
<html> <head></head> <body> <script> var monthName = function( num ){ var months = [/*w ww . j av a 2 s. c o m*/ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]; return months[ num - 1 ]; }; console.log( monthName( 6 ) ); </script> </body> </html>