Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <meta name="viewport" content="width=device-width">
  <title>JS Bin</title>
</head>
<body>
  <script language="javascript">
  var indexes = [1,2,3];
function find(val){
    function index (value) {
      return [1,2,3].indexOf(value);  
      return indexes.indexOf(value);
    }
    return index(val);
}
var start = Date.now();
for (i=0; i < 1000000; i++) {
    find(2);
}
console.log(Date.now() - start);
  </script>
</body>
</html>
Output

You can jump to the latest bin by adding /latest to your URL

Dismiss x
public
Bin info
anonymouspro
0viewers