Javascript - Error class reference

Introduction

The Error object provides error information when an error occurs.

Demo

try {
    adddlert("Welcome guest!");
}
catch(err) {/*from  w  w w  . ja  v a2s. com*/
    console.log(err.name + "\n" + err.message);
}

Result

Error Object Properties

Property Description
name Sets or returns an error name
message Sets or returns an error message (a string)