Array index offset : Array « Dojo toolkit « JavaScript DHTML






Array index offset

 

<html>
  <head>
    <link rel="StyleSheet" type="text/css"
      href="js/dojo/dijit/themes/tundra/tundra.css">
    <script type="text/javascript">
      var djConfig = {
        baseScriptUri : "js/dojo/",
        parseOnLoad : true
      };
    </script>
    <script type="text/javascript" src="js/dojo/dojo/dojo.js"></script>
    <script>
      dojo.require("dojo.parser");
      dojo.require("dojo.string");
      dojo.addOnLoad(f);
      
      function f(){
        var foo = [1,2,3];
        var bar = [4,5,6,5,6];
        var baz = [1,2,3];

        alert(dojo.indexOf([foo, bar], baz)); 
        alert(dojo.indexOf(foo, 3)); 
        alert(dojo.indexOf(bar, 6, 2));
        alert(dojo.indexOf(bar, 6, 3));
        alert(dojo.lastIndexOf(bar, 6));

        
      }
    </script>
  </head>
  <body class="tundra">
     

</body>
</html>

   
  








Dojo-toolkit.zip( 3,849 k)

Related examples in the same category

1.Array filter
2.Array index of
3.Get last index of
4.Is array like
5.Is object an array
6.Get element index in an array
7.Get item index