Skip welcome & menu and move to editor
Welcome to JS Bin
Load cached copy from
 
<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>Example</title>
</head>
<body>
  <iframe src="http://jsbin.com/fizoso/1"></iframe>
<script>
  var foo = (function() {
    "use strict";
    var toString = Object.prototype.toString;
    function isRegExp(value) { 
      return toString.call(value) === '[object RegExp]'; 
    }
    
    function foo(arg) {
      display("Using isRegExp: " + isRegExp(arg)); // true
      display("Using instanceof: " + (arg instanceof RegExp)); // false
    }
    
    function display(msg) {
      var p = document.createElement('p');
      p.innerHTML = String(msg);
      document.body.appendChild(p);
    }
    
    return foo;
  })();
</script>
</body>
</html>
Output

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

Dismiss x
public
Bin info
tjcrowderpro
0viewers