Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Programming \ [JavaScript] catch (ex) statements of ex     - WEB-based Android Remote Tools Python implementation (Programming)

- To create someone else can not afford to delete the administrator user (Linux)

- Java reflection by calling the class method (Programming)

- Use Nginx as a load balancer (Server)

- Redhat Close SELinux correct step (Linux)

- 10 easy to use Linux utilities Recommended (Linux)

- How to install the latest version of the Eclipse in Ubuntu 14.04 (Linux)

- C ++ 11 feature: auto keyword (Programming)

- Fedora 22 installation and configuration optimization (Linux)

- How to create a binary distribution with Bash (Linux)

- Linux NFS service fixed ports and firewall configuration (Linux)

- PL / SQL -> UTL_FILE use presentation package (Database)

- Build your own Web server under Ubuntu Linux system (Server)

- MySQL 5.6.26 source install (Database)

- Linux Basics Tutorial: create your own Vim IDE (Linux)

- Oracle rebuild index script (Database)

- Java multi-threaded in a three way (inheritance, implementation, anonymous inner classes) (Programming)

- Troubleshooting Linux virtual machine device id and the letter of inconsistencies (Linux)

- Using Lua implement various operations list (Programming)

- Using Linux command line and execute PHP code (Programming)

 
         
  [JavaScript] catch (ex) statements of ex
     
  Add Date : 2018-11-21      
         
         
         
  Try / catch statement is exception handling mechanism provided by the JavaScript statement, the statement once inside the try block throws an exception in the catch block to catch the exception information Error type. We know that there is no block scope in JavaScript, but this knowledge was obtained in the catch block inside the opposite phenomenon.

See the following code:

(Function () {
    try {
        throw new Error ( "error");
    }
    catch (ex) {
        console.log (ex.message);
    }
    finally {
        console.log ( "final");
    }
    console.log (ex);
}) ();

The code in the last line of the console output (console.log (ex);) will be thrown prompt, no ex this identifier. This phenomenon shows that in the catch block, ex scope confined statement block internal and external ex unresolved to this identifier.

The code will be a small adjustment in the catch inside reaffirmed ex variable.

(Function () {
    try {
        throw new Error ( "error");
    }
    catch (ex) {
        console.log (ex.message);
        var ex = "ex string";
    }
    finally {
        console.log ( "final");
    }
    console.log (ex);
}) ();

This time last line of the console output (console.log (ex);) does not throw an exception, but his output value is undefined, catch block in the statement of assignment and has no effect on the inside of the ex variable declaration, but to catch the captured ex it was assigned. This phenomenon is very strange, priority is to catch the exception identifier variable name resolution coverage.
     
         
         
         
  More:      
 
- C language Bubble Sort - integer sort (Programming)
- Ubuntu installation module Python rq (Linux)
- ActionContext and ServletActionContext Summary (Programming)
- Use LKM change the default linux security level (Linux)
- Compare Swift achieve rapid sorting and sorted Methods (Programming)
- Understanding the Linux load average on other UNIX-Like systems (Linux)
- Availability Hadoop platform - Oozie Workflow (Server)
- Oracle Standby Redo Log experiment (Database)
- Oracle Automatic Diagnostic Repository (Automatic Diagnostic Repository, ADR) (Database)
- Java annotations entry automatically generates SQL statements (Programming)
- Ubuntu uses under KVM + Qemu virtual machine build (Linux)
- Ubuntu 14.10 / Linux Mint 17.1 Win10 compiler install rdesktop 1.8.3 Remote Desktop connection (Linux)
- Cache implementation APP interacts with the server-side interface control Session (Server)
- JQuery implements the same content merge cells (Programming)
- Linux server data backup (Server)
- Linux installation beautify early experience (Linux)
- Replace font under Linux (Linux)
- Help you make Git Bisect (Linux)
- Installation image conversion tool on your Ubuntu Converseen 0.8.1 (Linux)
- Configure the ASM process on Red Hat Linux 6.5 (Database)
     
           
     
  CopyRight 2002-2020 newfreesoft.com, All Rights Reserved.