function permutation(a) {
if(!(a instanceof Array)) {
throw new Error(a + ' is not an array');
}
}
// permutation('ABC'); // -> Uncaught Error: ABC is not an array
// # 例外オブジェクト
// x++; // -> Uncaught ReferenceError: x is not defined
var a = 10;
// if(a > 0) { a++; //-> SyntaxError
var obj = {};
// obj.join(); // -> TypeError: obj.join is not a function
var pi = 3.14159;
// pi.toFixed(1000); // -> Uncaught RangeError: toFixed() digits argument must be between 0 and 100
// decodeURIComponent('%'); // -> Uncaught URIError: URI malformed
// # Error.prototype
var error = new TypeError('配列ではありません');
console.log(error.message);
console.log(error.name);
console.log(error.toString());
JS-例外
-----
A [Pen](https://codepen.io/taquaki/pen/ypyJxK) by [Takaaki Sato](https://codepen.io/taquaki) on [CodePen](https://codepen.io).
[License](https://codepen.io/taquaki/pen/ypyJxK/license).